-rw-r--r-- | kaddressbook/kabcore.cpp | 4 | ||||
-rw-r--r-- | kmicromail/composemail.cpp | 11 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 62 | ||||
-rw-r--r-- | kmicromail/opiemail.h | 2 |
4 files changed, 49 insertions, 30 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index d1d385c..74e5cf7 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1873,282 +1873,282 @@ void KABCore::addActionsManually() | |||
1873 | mActionQuit->plug( fileMenu ); | 1873 | mActionQuit->plug( fileMenu ); |
1874 | #ifdef _WIN32_ | 1874 | #ifdef _WIN32_ |
1875 | mActionImportOL->plug( ImportMenu ); | 1875 | mActionImportOL->plug( ImportMenu ); |
1876 | #endif | 1876 | #endif |
1877 | // edit menu | 1877 | // edit menu |
1878 | mActionUndo->plug( editMenu ); | 1878 | mActionUndo->plug( editMenu ); |
1879 | mActionRedo->plug( editMenu ); | 1879 | mActionRedo->plug( editMenu ); |
1880 | editMenu->insertSeparator(); | 1880 | editMenu->insertSeparator(); |
1881 | mActionCut->plug( editMenu ); | 1881 | mActionCut->plug( editMenu ); |
1882 | mActionCopy->plug( editMenu ); | 1882 | mActionCopy->plug( editMenu ); |
1883 | mActionPaste->plug( editMenu ); | 1883 | mActionPaste->plug( editMenu ); |
1884 | mActionDelete->plug( editMenu ); | 1884 | mActionDelete->plug( editMenu ); |
1885 | editMenu->insertSeparator(); | 1885 | editMenu->insertSeparator(); |
1886 | mActionSelectAll->plug( editMenu ); | 1886 | mActionSelectAll->plug( editMenu ); |
1887 | 1887 | ||
1888 | mActionRemoveVoice->plug( changeMenu ); | 1888 | mActionRemoveVoice->plug( changeMenu ); |
1889 | // settings menu | 1889 | // settings menu |
1890 | //US special menuentry to configure the addressbook resources. On KDE | 1890 | //US special menuentry to configure the addressbook resources. On KDE |
1891 | // you do that through the control center !!! | 1891 | // you do that through the control center !!! |
1892 | mActionConfigResources->plug( settingsMenu ); | 1892 | mActionConfigResources->plug( settingsMenu ); |
1893 | settingsMenu->insertSeparator(); | 1893 | settingsMenu->insertSeparator(); |
1894 | 1894 | ||
1895 | mActionConfigKAddressbook->plug( settingsMenu ); | 1895 | mActionConfigKAddressbook->plug( settingsMenu ); |
1896 | 1896 | ||
1897 | if ( mIsPart ) { | 1897 | if ( mIsPart ) { |
1898 | mActionConfigShortcuts->plug( settingsMenu ); | 1898 | mActionConfigShortcuts->plug( settingsMenu ); |
1899 | mActionConfigureToolbars->plug( settingsMenu ); | 1899 | mActionConfigureToolbars->plug( settingsMenu ); |
1900 | 1900 | ||
1901 | } else { | 1901 | } else { |
1902 | mActionKeyBindings->plug( settingsMenu ); | 1902 | mActionKeyBindings->plug( settingsMenu ); |
1903 | } | 1903 | } |
1904 | 1904 | ||
1905 | settingsMenu->insertSeparator(); | 1905 | settingsMenu->insertSeparator(); |
1906 | 1906 | ||
1907 | mActionJumpBar->plug( settingsMenu ); | 1907 | mActionJumpBar->plug( settingsMenu ); |
1908 | mActionDetails->plug( settingsMenu ); | 1908 | mActionDetails->plug( settingsMenu ); |
1909 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 1909 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
1910 | mActionDetails->plug( tb ); | 1910 | mActionDetails->plug( tb ); |
1911 | settingsMenu->insertSeparator(); | 1911 | settingsMenu->insertSeparator(); |
1912 | 1912 | ||
1913 | mActionWhoAmI->plug( settingsMenu ); | 1913 | mActionWhoAmI->plug( settingsMenu ); |
1914 | mActionCategories->plug( settingsMenu ); | 1914 | mActionCategories->plug( settingsMenu ); |
1915 | 1915 | ||
1916 | mActionLicence->plug( helpMenu ); | 1916 | mActionLicence->plug( helpMenu ); |
1917 | mActionFaq->plug( helpMenu ); | 1917 | mActionFaq->plug( helpMenu ); |
1918 | mActionAboutKAddressbook->plug( helpMenu ); | 1918 | mActionAboutKAddressbook->plug( helpMenu ); |
1919 | 1919 | ||
1920 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 1920 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
1921 | 1921 | ||
1922 | mActionSave->plug( tb ); | 1922 | mActionSave->plug( tb ); |
1923 | mViewManager->getFilterAction()->plug ( tb); | 1923 | mViewManager->getFilterAction()->plug ( tb); |
1924 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 1924 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
1925 | mActionUndo->plug( tb ); | 1925 | mActionUndo->plug( tb ); |
1926 | mActionDelete->plug( tb ); | 1926 | mActionDelete->plug( tb ); |
1927 | mActionRedo->plug( tb ); | 1927 | mActionRedo->plug( tb ); |
1928 | } | 1928 | } |
1929 | } | 1929 | } |
1930 | //mActionQuit->plug ( tb ); | 1930 | //mActionQuit->plug ( tb ); |
1931 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1931 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1932 | 1932 | ||
1933 | //US link the searchwidget first to this. | 1933 | //US link the searchwidget first to this. |
1934 | // The real linkage to the toolbar happens later. | 1934 | // The real linkage to the toolbar happens later. |
1935 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1935 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1936 | //US tb->insertItem( mIncSearchWidget ); | 1936 | //US tb->insertItem( mIncSearchWidget ); |
1937 | /*US | 1937 | /*US |
1938 | mIncSearchWidget = new IncSearchWidget( tb ); | 1938 | mIncSearchWidget = new IncSearchWidget( tb ); |
1939 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1939 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1940 | SLOT( incrementalSearch( const QString& ) ) ); | 1940 | SLOT( incrementalSearch( const QString& ) ) ); |
1941 | 1941 | ||
1942 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1942 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1943 | 1943 | ||
1944 | //US topLayout->addWidget( mJumpButtonBar ); | 1944 | //US topLayout->addWidget( mJumpButtonBar ); |
1945 | this->layout()->add( mJumpButtonBar ); | 1945 | this->layout()->add( mJumpButtonBar ); |
1946 | */ | 1946 | */ |
1947 | 1947 | ||
1948 | #endif //KAB_EMBEDDED | 1948 | #endif //KAB_EMBEDDED |
1949 | } | 1949 | } |
1950 | void KABCore::showLicence() | 1950 | void KABCore::showLicence() |
1951 | { | 1951 | { |
1952 | KApplication::showLicence(); | 1952 | KApplication::showLicence(); |
1953 | } | 1953 | } |
1954 | void KABCore::removeVoice() | 1954 | void KABCore::removeVoice() |
1955 | { | 1955 | { |
1956 | 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 ) | 1956 | 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 ) |
1957 | return; | 1957 | return; |
1958 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 1958 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
1959 | KABC::Addressee::List::Iterator it; | 1959 | KABC::Addressee::List::Iterator it; |
1960 | for ( it = list.begin(); it != list.end(); ++it ) { | 1960 | for ( it = list.begin(); it != list.end(); ++it ) { |
1961 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); | 1961 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); |
1962 | PhoneNumber::List::Iterator phoneIt; | 1962 | PhoneNumber::List::Iterator phoneIt; |
1963 | bool found = false; | 1963 | bool found = false; |
1964 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 1964 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
1965 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 1965 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
1966 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 1966 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
1967 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 1967 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
1968 | (*it).insertPhoneNumber( (*phoneIt) ); | 1968 | (*it).insertPhoneNumber( (*phoneIt) ); |
1969 | found = true; | 1969 | found = true; |
1970 | } | 1970 | } |
1971 | } | 1971 | } |
1972 | 1972 | ||
1973 | } | 1973 | } |
1974 | if ( found ) | 1974 | if ( found ) |
1975 | contactModified((*it) ); | 1975 | contactModified((*it) ); |
1976 | } | 1976 | } |
1977 | } | 1977 | } |
1978 | 1978 | ||
1979 | 1979 | ||
1980 | 1980 | ||
1981 | void KABCore::clipboardDataChanged() | 1981 | void KABCore::clipboardDataChanged() |
1982 | { | 1982 | { |
1983 | 1983 | ||
1984 | if ( mReadWrite ) | 1984 | if ( mReadWrite ) |
1985 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1985 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1986 | 1986 | ||
1987 | } | 1987 | } |
1988 | 1988 | ||
1989 | void KABCore::updateActionMenu() | 1989 | void KABCore::updateActionMenu() |
1990 | { | 1990 | { |
1991 | UndoStack *undo = UndoStack::instance(); | 1991 | UndoStack *undo = UndoStack::instance(); |
1992 | RedoStack *redo = RedoStack::instance(); | 1992 | RedoStack *redo = RedoStack::instance(); |
1993 | 1993 | ||
1994 | if ( undo->isEmpty() ) | 1994 | if ( undo->isEmpty() ) |
1995 | mActionUndo->setText( i18n( "Undo" ) ); | 1995 | mActionUndo->setText( i18n( "Undo" ) ); |
1996 | else | 1996 | else |
1997 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 1997 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
1998 | 1998 | ||
1999 | mActionUndo->setEnabled( !undo->isEmpty() ); | 1999 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2000 | 2000 | ||
2001 | if ( !redo->top() ) | 2001 | if ( !redo->top() ) |
2002 | mActionRedo->setText( i18n( "Redo" ) ); | 2002 | mActionRedo->setText( i18n( "Redo" ) ); |
2003 | else | 2003 | else |
2004 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2004 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2005 | 2005 | ||
2006 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2006 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2007 | } | 2007 | } |
2008 | 2008 | ||
2009 | void KABCore::configureKeyBindings() | 2009 | void KABCore::configureKeyBindings() |
2010 | { | 2010 | { |
2011 | #ifndef KAB_EMBEDDED | 2011 | #ifndef KAB_EMBEDDED |
2012 | KKeyDialog::configure( actionCollection(), true ); | 2012 | KKeyDialog::configure( actionCollection(), true ); |
2013 | #else //KAB_EMBEDDED | 2013 | #else //KAB_EMBEDDED |
2014 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2014 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2015 | #endif //KAB_EMBEDDED | 2015 | #endif //KAB_EMBEDDED |
2016 | } | 2016 | } |
2017 | 2017 | ||
2018 | #ifdef KAB_EMBEDDED | 2018 | #ifdef KAB_EMBEDDED |
2019 | void KABCore::configureResources() | 2019 | void KABCore::configureResources() |
2020 | { | 2020 | { |
2021 | KRES::KCMKResources dlg( this, "" , 0 ); | 2021 | KRES::KCMKResources dlg( this, "" , 0 ); |
2022 | 2022 | ||
2023 | if ( !dlg.exec() ) | 2023 | if ( !dlg.exec() ) |
2024 | return; | 2024 | return; |
2025 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2025 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2026 | } | 2026 | } |
2027 | #endif //KAB_EMBEDDED | 2027 | #endif //KAB_EMBEDDED |
2028 | 2028 | ||
2029 | 2029 | ||
2030 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2030 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2031 | * for the attendees list of an event. | 2031 | * for the attendees list of an event. |
2032 | */ | 2032 | */ |
2033 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2033 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2034 | { | 2034 | { |
2035 | QStringList nameList; | 2035 | QStringList nameList; |
2036 | QStringList emailList; | 2036 | QStringList emailList; |
2037 | QStringList uidList; | 2037 | QStringList uidList; |
2038 | 2038 | ||
2039 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2039 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2040 | uint i=0; | 2040 | uint i=0; |
2041 | for (i=0; i < list.count(); i++) | 2041 | for (i=0; i < list.count(); i++) |
2042 | { | 2042 | { |
2043 | nameList.append(list[i].realName()); | 2043 | nameList.append(list[i].realName()); |
2044 | emailList.append(list[i].preferredEmail()); | 2044 | emailList.append(list[i].preferredEmail()); |
2045 | uidList.append(list[i].uid()); | 2045 | uidList.append(list[i].uid()); |
2046 | } | 2046 | } |
2047 | 2047 | ||
2048 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2048 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2049 | 2049 | ||
2050 | } | 2050 | } |
2051 | 2051 | ||
2052 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2052 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2053 | */ | 2053 | */ |
2054 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2054 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2055 | { | 2055 | { |
2056 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2056 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2057 | 2057 | ||
2058 | QString foundUid = QString::null; | 2058 | QString foundUid = QString::null; |
2059 | if ( ! uid.isEmpty() ) { | 2059 | if ( ! uid.isEmpty() ) { |
2060 | Addressee adrr = mAddressBook->findByUid( uid ); | 2060 | Addressee adrr = mAddressBook->findByUid( uid ); |
2061 | if ( !adrr.isEmpty() ) { | 2061 | if ( !adrr.isEmpty() ) { |
2062 | foundUid = uid; | 2062 | foundUid = uid; |
2063 | } | 2063 | } |
2064 | if ( email == "sendbacklist" ) { | 2064 | if ( email == "sendbacklist" ) { |
2065 | qDebug("ssssssssssssssssssssssend "); | 2065 | //qDebug("ssssssssssssssssssssssend "); |
2066 | QStringList nameList; | 2066 | QStringList nameList; |
2067 | QStringList emailList; | 2067 | QStringList emailList; |
2068 | QStringList uidList; | 2068 | QStringList uidList; |
2069 | nameList.append(adrr.realName()); | 2069 | nameList.append(adrr.realName()); |
2070 | emailList = adrr.emails(); | 2070 | emailList = adrr.emails(); |
2071 | uidList.append( adrr.preferredEmail()); | 2071 | uidList.append( adrr.preferredEmail()); |
2072 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2072 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2073 | return; | 2073 | return; |
2074 | } | 2074 | } |
2075 | 2075 | ||
2076 | } | 2076 | } |
2077 | 2077 | ||
2078 | if ( email == "sendback" ) | 2078 | if ( email == "sendbacklist" ) |
2079 | return; | 2079 | return; |
2080 | if (foundUid.isEmpty()) | 2080 | if (foundUid.isEmpty()) |
2081 | { | 2081 | { |
2082 | //find the uid of the person first | 2082 | //find the uid of the person first |
2083 | Addressee::List namelist; | 2083 | Addressee::List namelist; |
2084 | Addressee::List emaillist; | 2084 | Addressee::List emaillist; |
2085 | 2085 | ||
2086 | if (!name.isEmpty()) | 2086 | if (!name.isEmpty()) |
2087 | namelist = mAddressBook->findByName( name ); | 2087 | namelist = mAddressBook->findByName( name ); |
2088 | 2088 | ||
2089 | if (!email.isEmpty()) | 2089 | if (!email.isEmpty()) |
2090 | emaillist = mAddressBook->findByEmail( email ); | 2090 | emaillist = mAddressBook->findByEmail( email ); |
2091 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2091 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2092 | //check if we have a match in Namelist and Emaillist | 2092 | //check if we have a match in Namelist and Emaillist |
2093 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2093 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2094 | foundUid = emaillist[0].uid(); | 2094 | foundUid = emaillist[0].uid(); |
2095 | } | 2095 | } |
2096 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2096 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2097 | foundUid = namelist[0].uid(); | 2097 | foundUid = namelist[0].uid(); |
2098 | else | 2098 | else |
2099 | { | 2099 | { |
2100 | for (int i = 0; i < namelist.count(); i++) | 2100 | for (int i = 0; i < namelist.count(); i++) |
2101 | { | 2101 | { |
2102 | for (int j = 0; j < emaillist.count(); j++) | 2102 | for (int j = 0; j < emaillist.count(); j++) |
2103 | { | 2103 | { |
2104 | if (namelist[i] == emaillist[j]) | 2104 | if (namelist[i] == emaillist[j]) |
2105 | { | 2105 | { |
2106 | foundUid = namelist[i].uid(); | 2106 | foundUid = namelist[i].uid(); |
2107 | } | 2107 | } |
2108 | } | 2108 | } |
2109 | } | 2109 | } |
2110 | } | 2110 | } |
2111 | } | 2111 | } |
2112 | else | 2112 | else |
2113 | { | 2113 | { |
2114 | foundUid = uid; | 2114 | foundUid = uid; |
2115 | } | 2115 | } |
2116 | 2116 | ||
2117 | if (!foundUid.isEmpty()) | 2117 | if (!foundUid.isEmpty()) |
2118 | { | 2118 | { |
2119 | 2119 | ||
2120 | // raise Ka/Pi if it is in the background | 2120 | // raise Ka/Pi if it is in the background |
2121 | #ifndef DESKTOP_VERSION | 2121 | #ifndef DESKTOP_VERSION |
2122 | #ifndef KORG_NODCOP | 2122 | #ifndef KORG_NODCOP |
2123 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2123 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2124 | #endif | 2124 | #endif |
2125 | #endif | 2125 | #endif |
2126 | 2126 | ||
2127 | mMainWindow->showMaximized(); | 2127 | mMainWindow->showMaximized(); |
2128 | mMainWindow-> raise(); | 2128 | mMainWindow-> raise(); |
2129 | 2129 | ||
2130 | mViewManager->setSelected( "", false); | 2130 | mViewManager->setSelected( "", false); |
2131 | mViewManager->refreshView( "" ); | 2131 | mViewManager->refreshView( "" ); |
2132 | mViewManager->setSelected( foundUid, true ); | 2132 | mViewManager->setSelected( foundUid, true ); |
2133 | mViewManager->refreshView( foundUid ); | 2133 | mViewManager->refreshView( foundUid ); |
2134 | 2134 | ||
2135 | if ( !mMultipleViewsAtOnce ) | 2135 | if ( !mMultipleViewsAtOnce ) |
2136 | { | 2136 | { |
2137 | setDetailsVisible( true ); | 2137 | setDetailsVisible( true ); |
2138 | mActionDetails->setChecked(true); | 2138 | mActionDetails->setChecked(true); |
2139 | } | 2139 | } |
2140 | } | 2140 | } |
2141 | } | 2141 | } |
2142 | 2142 | ||
2143 | 2143 | ||
2144 | void KABCore::faq() | 2144 | void KABCore::faq() |
2145 | { | 2145 | { |
2146 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2146 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2147 | } | 2147 | } |
2148 | 2148 | ||
2149 | 2149 | ||
2150 | 2150 | ||
2151 | 2151 | ||
2152 | #ifndef KAB_EMBEDDED | 2152 | #ifndef KAB_EMBEDDED |
2153 | #include "kabcore.moc" | 2153 | #include "kabcore.moc" |
2154 | #endif //KAB_EMBEDDED | 2154 | #endif //KAB_EMBEDDED |
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 01dd406..9efa932 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -1,396 +1,397 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | #include "composemail.h" | 3 | #include "composemail.h" |
4 | 4 | ||
5 | #include <libmailwrapper/smtpwrapper.h> | 5 | #include <libmailwrapper/smtpwrapper.h> |
6 | #include <libmailwrapper/storemail.h> | 6 | #include <libmailwrapper/storemail.h> |
7 | #include <libmailwrapper/abstractmail.h> | 7 | #include <libmailwrapper/abstractmail.h> |
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
9 | 9 | ||
10 | /* OPIE */ | 10 | /* OPIE */ |
11 | //#include <opie2/ofiledialog.h> | 11 | //#include <opie2/ofiledialog.h> |
12 | //#include <opie2/odebug.h> | 12 | //#include <opie2/odebug.h> |
13 | #include <kfiledialog.h> | 13 | #include <kfiledialog.h> |
14 | //#include <qpe/resource.h> | 14 | //#include <qpe/resource.h> |
15 | #include <qpe/config.h> | 15 | #include <qpe/config.h> |
16 | #include <qpe/global.h> | 16 | #include <qpe/global.h> |
17 | //#include <qpe/contact.h> | 17 | //#include <qpe/contact.h> |
18 | 18 | ||
19 | 19 | ||
20 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
21 | #include <qcheckbox.h> | 21 | #include <qcheckbox.h> |
22 | #include <qtimer.h> | 22 | #include <qtimer.h> |
23 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
24 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
25 | #include <qmultilineedit.h> | 25 | #include <qmultilineedit.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qtabwidget.h> | 27 | #include <qtabwidget.h> |
28 | #include <qlistview.h> | 28 | #include <qlistview.h> |
29 | #include <kabc/addresseedialog.h> | 29 | #include <kabc/addresseedialog.h> |
30 | #include <kabc/stdaddressbook.h> | 30 | #include <kabc/stdaddressbook.h> |
31 | #include <kabc/addressee.h> | 31 | #include <kabc/addressee.h> |
32 | #ifdef DESKTOP_VERSION | 32 | #ifdef DESKTOP_VERSION |
33 | #include <kabc/addresseedialog.h> | 33 | #include <kabc/addresseedialog.h> |
34 | #else //DESKTOP_VERSION | 34 | #else //DESKTOP_VERSION |
35 | #include <libkdepim/externalapphandler.h> | 35 | #include <libkdepim/externalapphandler.h> |
36 | #endif //DESKTOP_VERSION | 36 | #endif //DESKTOP_VERSION |
37 | 37 | ||
38 | 38 | ||
39 | //using namespace Opie::Core; | 39 | //using namespace Opie::Core; |
40 | //using namespace Opie::Ui; | 40 | //using namespace Opie::Ui; |
41 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) | 41 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) |
42 | : ComposeMailUI( parent, name, modal ) | 42 | : ComposeMailUI( parent, name, modal ) |
43 | { | 43 | { |
44 | 44 | ||
45 | mPickLineEdit = 0; | 45 | mPickLineEdit = 0; |
46 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 46 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
47 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 47 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
48 | settings = s; | 48 | settings = s; |
49 | m_replyid = ""; | 49 | m_replyid = ""; |
50 | KConfig config( locateLocal("config", "kabcrc") ); | 50 | KConfig config( locateLocal("config", "kabcrc") ); |
51 | config.setGroup( "General" ); | 51 | config.setGroup( "General" ); |
52 | QString whoami_uid = config.readEntry( "WhoAmI" ); | 52 | QString whoami_uid = config.readEntry( "WhoAmI" ); |
53 | |||
53 | if ( whoami_uid.isEmpty() ) { | 54 | if ( whoami_uid.isEmpty() ) { |
54 | QMessageBox::information( 0, tr( "Hint" ), | 55 | QMessageBox::information( 0, tr( "Hint" ), |
55 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 56 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
56 | tr( "Ok" ) ); | 57 | tr( "Ok" ) ); |
57 | 58 | ||
58 | } else | 59 | } else |
59 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); | 60 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); |
61 | |||
62 | |||
60 | #ifdef DESKTOP_VERSION | 63 | #ifdef DESKTOP_VERSION |
61 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); | 64 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); |
62 | QStringList mails = con.emails(); | 65 | QStringList mails = con.emails(); |
63 | QString defmail = con.preferredEmail(); | 66 | QString defmail = con.preferredEmail(); |
64 | if ( mails.count() == 0) | 67 | if ( mails.count() == 0) |
65 | QMessageBox::information( 0, tr( "Hint" ), | 68 | QMessageBox::information( 0, tr( "Hint" ), |
66 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 69 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
67 | tr( "Ok" ) ); | 70 | tr( "Ok" ) ); |
68 | if (defmail.length()!=0) { | 71 | if (defmail.length()!=0) { |
69 | fromBox->insertItem(defmail); | 72 | fromBox->insertItem(defmail); |
70 | } | 73 | } |
71 | QStringList::ConstIterator sit = mails.begin(); | 74 | QStringList::ConstIterator sit = mails.begin(); |
72 | for (;sit!=mails.end();++sit) { | 75 | for (;sit!=mails.end();++sit) { |
73 | if ( (*sit)==defmail) | 76 | if ( (*sit)==defmail) |
74 | continue; | 77 | continue; |
75 | fromBox->insertItem((*sit)); | 78 | fromBox->insertItem((*sit)); |
76 | } | 79 | } |
77 | senderNameEdit->setText(con.formattedName()); | 80 | senderNameEdit->setText(con.formattedName()); |
78 | #endif | 81 | #endif |
79 | Config cfg( "mail" ); | 82 | Config cfg( "mail" ); |
80 | cfg.setGroup( "Compose" ); | 83 | cfg.setGroup( "Compose" ); |
81 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 84 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); |
82 | 85 | ||
83 | attList->addColumn( tr( "Name" ) ); | 86 | attList->addColumn( tr( "Name" ) ); |
84 | attList->addColumn( tr( "Size" ) ); | 87 | attList->addColumn( tr( "Size" ) ); |
85 | |||
86 | QList<Account> accounts = settings->getAccounts(); | 88 | QList<Account> accounts = settings->getAccounts(); |
87 | 89 | ||
88 | Account *it; | 90 | Account *it; |
89 | for ( it = accounts.first(); it; it = accounts.next() ) { | 91 | for ( it = accounts.first(); it; it = accounts.next() ) { |
90 | if ( it->getType()==MAILLIB::A_SMTP ) { | 92 | if ( it->getType()==MAILLIB::A_SMTP ) { |
91 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 93 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
92 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 94 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
93 | smtpAccounts.append( smtp ); | 95 | smtpAccounts.append( smtp ); |
94 | } | 96 | } |
95 | } | 97 | } |
96 | if ( smtpAccounts.count() > 0 ) { | 98 | if ( smtpAccounts.count() > 0 ) { |
97 | fillValues( smtpAccountBox->currentItem() ); | 99 | fillValues( smtpAccountBox->currentItem() ); |
98 | } else { | 100 | } else { |
99 | QMessageBox::information( 0, tr( "Problem" ), | 101 | QMessageBox::information( 0, tr( "Problem" ), |
100 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), | 102 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), |
101 | tr( "Ok" ) ); | 103 | tr( "Ok" ) ); |
102 | return; | 104 | return; |
103 | } | 105 | } |
104 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 106 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
105 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 107 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
106 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 108 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
107 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 109 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
108 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 110 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
109 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 111 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
110 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 112 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
111 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); | 113 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); |
112 | mMail = 0; | 114 | mMail = 0; |
113 | warnAttach = true; | 115 | warnAttach = true; |
114 | 116 | ||
115 | } | 117 | } |
116 | 118 | ||
117 | 119 | ||
118 | 120 | ||
119 | void ComposeMail::saveAsDraft() | 121 | void ComposeMail::saveAsDraft() |
120 | { | 122 | { |
121 | 123 | ||
122 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); | 124 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); |
123 | mail->setMail(fromBox->currentText()); | 125 | mail->setMail(fromBox->currentText()); |
124 | mail->setTo( toLine->text() ); | 126 | mail->setTo( toLine->text() ); |
125 | mail->setName(senderNameEdit->text()); | 127 | mail->setName(senderNameEdit->text()); |
126 | mail->setCC( ccLine->text() ); | 128 | mail->setCC( ccLine->text() ); |
127 | mail->setBCC( bccLine->text() ); | 129 | mail->setBCC( bccLine->text() ); |
128 | mail->setReply( replyLine->text() ); | 130 | mail->setReply( replyLine->text() ); |
129 | mail->setSubject( subjectLine->text() ); | 131 | mail->setSubject( subjectLine->text() ); |
130 | if (!m_replyid.isEmpty()) { | 132 | if (!m_replyid.isEmpty()) { |
131 | QStringList ids; | 133 | QStringList ids; |
132 | ids.append(m_replyid); | 134 | ids.append(m_replyid); |
133 | mail->setInreply(ids); | 135 | mail->setInreply(ids); |
134 | } | 136 | } |
135 | QString txt = message->text(); | 137 | QString txt = message->text(); |
136 | if ( !sigMultiLine->text().isEmpty() ) { | 138 | if ( !sigMultiLine->text().isEmpty() ) { |
137 | txt.append( "\n--\n" ); | 139 | txt.append( "\n--\n" ); |
138 | txt.append( sigMultiLine->text() ); | 140 | txt.append( sigMultiLine->text() ); |
139 | } | 141 | } |
140 | mail->setMessage( txt ); | 142 | mail->setMessage( txt ); |
141 | 143 | ||
142 | /* only use the default drafts folder name! */ | 144 | /* only use the default drafts folder name! */ |
143 | Storemail wrapper(AbstractMail::draftFolder()); | 145 | Storemail wrapper(AbstractMail::draftFolder()); |
144 | wrapper.storeMail(mail); | 146 | wrapper.storeMail(mail); |
145 | 147 | ||
146 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 148 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
147 | /* attachments we will ignore! */ | 149 | /* attachments we will ignore! */ |
148 | if ( it != 0 ) { | 150 | if ( it != 0 ) { |
149 | if ( warnAttach ) | 151 | if ( warnAttach ) |
150 | QMessageBox::warning(0,tr("Store message"), | 152 | QMessageBox::warning(0,tr("Store message"), |
151 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 153 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
152 | warnAttach = false; | 154 | warnAttach = false; |
153 | } | 155 | } |
154 | setStatus( tr("Mail saved as draft!") ); | 156 | setStatus( tr("Mail saved as draft!") ); |
155 | } | 157 | } |
156 | void ComposeMail::clearStatus() | 158 | void ComposeMail::clearStatus() |
157 | { | 159 | { |
158 | topLevelWidget()->setCaption( tr("Compose mail") ); | 160 | topLevelWidget()->setCaption( tr("Compose mail") ); |
159 | } | 161 | } |
160 | void ComposeMail::setStatus( QString status ) | 162 | void ComposeMail::setStatus( QString status ) |
161 | { | 163 | { |
162 | topLevelWidget()->setCaption( status ); | 164 | topLevelWidget()->setCaption( status ); |
163 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; | 165 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; |
164 | } | 166 | } |
165 | void ComposeMail::pickAddress( ) | 167 | void ComposeMail::pickAddress( ) |
166 | { | 168 | { |
167 | 169 | ||
168 | QLineEdit *line = mPickLineEdit; | 170 | QLineEdit *line = mPickLineEdit; |
169 | if ( line == 0 ) | 171 | if ( line == 0 ) |
170 | return; | 172 | return; |
171 | #ifdef DESKTOP_VERSION | 173 | #ifdef DESKTOP_VERSION |
172 | //qDebug(" ComposeMail::pickAddress "); | 174 | //qDebug(" ComposeMail::pickAddress "); |
173 | QString names ;//= AddressPicker::getNames(); | 175 | QString names ;//= AddressPicker::getNames(); |
174 | 176 | ||
175 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 177 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
176 | uint i=0; | 178 | uint i=0; |
177 | for (i=0; i < list.count(); i++) { | 179 | for (i=0; i < list.count(); i++) { |
178 | if ( !list[i].preferredEmail().isEmpty()) { | 180 | if ( !list[i].preferredEmail().isEmpty()) { |
179 | if ( ! names.isEmpty() ) | 181 | if ( ! names.isEmpty() ) |
180 | names+= ","; | 182 | names+= ","; |
181 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; | 183 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; |
182 | 184 | ||
183 | } | 185 | } |
184 | } | 186 | } |
185 | 187 | ||
186 | 188 | ||
187 | if ( line->text().isEmpty() ) { | 189 | if ( line->text().isEmpty() ) { |
188 | line->setText( names ); | 190 | line->setText( names ); |
189 | } else if ( !names.isEmpty() ) { | 191 | } else if ( !names.isEmpty() ) { |
190 | line->setText( line->text() + ", " + names ); | 192 | line->setText( line->text() + ", " + names ); |
191 | } | 193 | } |
192 | #else | 194 | #else |
193 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); | 195 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); |
194 | // the result should now arrive through method insertAttendees | 196 | // the result should now arrive through method insertAttendees |
195 | #endif | 197 | #endif |
196 | } | 198 | } |
197 | //the map includes name/email pairs, that comes from Ka/Pi | 199 | //the map includes name/email pairs, that comes from Ka/Pi |
198 | void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | 200 | void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) |
199 | { | 201 | { |
200 | qDebug("ComposeMail::insertAttendees "); | 202 | //qDebug("ComposeMail::insertAttendees "); |
201 | raise(); | 203 | raise(); |
202 | 204 | ||
203 | if ( mPickLineEdit == 0 ) { //whoami received | 205 | if ( mPickLineEdit == 0 ) { //whoami received |
204 | qDebug("returnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn "); | ||
205 | QString defmail = uidList[0]; | 206 | QString defmail = uidList[0]; |
206 | if ( emailList.count() == 0 ) | 207 | if ( emailList.count() == 0 ) |
207 | QMessageBox::information( 0, tr( "Hint" ), | 208 | QMessageBox::information( 0, tr( "Hint" ), |
208 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 209 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
209 | tr( "Ok" ) ); | 210 | tr( "Ok" ) ); |
210 | if (defmail.length()!=0) { | 211 | if (defmail.length()!=0) { |
211 | fromBox->insertItem(defmail); | 212 | fromBox->insertItem(defmail); |
212 | } | 213 | } |
213 | QStringList::ConstIterator sit = emailList.begin(); | 214 | QStringList::ConstIterator sit = emailList.begin(); |
214 | int pref = 0; | 215 | int pref = 0; |
215 | for (;sit!=emailList.end();++sit) { | 216 | for (;sit!=emailList.end();++sit) { |
216 | if ( (*sit)==defmail) | 217 | if ( (*sit)==defmail) |
217 | continue; | 218 | continue; |
218 | fromBox->insertItem((*sit)); | 219 | fromBox->insertItem((*sit)); |
219 | } | 220 | } |
220 | senderNameEdit->setText(nameList[0]); | 221 | senderNameEdit->setText(nameList[0]); |
221 | return; | 222 | return; |
222 | } | 223 | } |
223 | QString names ; | 224 | QString names ; |
224 | QLineEdit *line = mPickLineEdit; | 225 | QLineEdit *line = mPickLineEdit; |
225 | if (uid == this->name()) | 226 | if (uid == this->name()) |
226 | { | 227 | { |
227 | for ( int i = 0; i < nameList.count(); i++) | 228 | for ( int i = 0; i < nameList.count(); i++) |
228 | { | 229 | { |
229 | QString _name = nameList[i]; | 230 | QString _name = nameList[i]; |
230 | QString _email = emailList[i]; | 231 | QString _email = emailList[i]; |
231 | QString _uid = uidList[i]; | 232 | QString _uid = uidList[i]; |
232 | if ( ! _email.isEmpty() ) { | 233 | if ( ! _email.isEmpty() ) { |
233 | if ( ! names.isEmpty() ) | 234 | if ( ! names.isEmpty() ) |
234 | names+= ","; | 235 | names+= ","; |
235 | names+= "\""+_name +"\"<" +_email +">"; | 236 | names+= "\""+_name +"\"<" +_email +">"; |
236 | } | 237 | } |
237 | } | 238 | } |
238 | } | 239 | } |
239 | if ( line->text().isEmpty() ) { | 240 | if ( line->text().isEmpty() ) { |
240 | line->setText( names ); | 241 | line->setText( names ); |
241 | } else if ( !names.isEmpty() ) { | 242 | } else if ( !names.isEmpty() ) { |
242 | line->setText( line->text() + ", " + names ); | 243 | line->setText( line->text() + ", " + names ); |
243 | } | 244 | } |
244 | } | 245 | } |
245 | 246 | ||
246 | void ComposeMail::setTo( const QString & to ) | 247 | void ComposeMail::setTo( const QString & to ) |
247 | { | 248 | { |
248 | toLine->setText( to ); | 249 | toLine->setText( to ); |
249 | } | 250 | } |
250 | 251 | ||
251 | void ComposeMail::setSubject( const QString & subject ) | 252 | void ComposeMail::setSubject( const QString & subject ) |
252 | { | 253 | { |
253 | subjectLine->setText( subject ); | 254 | subjectLine->setText( subject ); |
254 | } | 255 | } |
255 | 256 | ||
256 | void ComposeMail::setInReplyTo( const QString & messageId ) | 257 | void ComposeMail::setInReplyTo( const QString & messageId ) |
257 | { | 258 | { |
258 | m_replyid = messageId; | 259 | m_replyid = messageId; |
259 | } | 260 | } |
260 | 261 | ||
261 | void ComposeMail::setMessage( const QString & text ) | 262 | void ComposeMail::setMessage( const QString & text ) |
262 | { | 263 | { |
263 | message->setText( text ); | 264 | message->setText( text ); |
264 | } | 265 | } |
265 | 266 | ||
266 | 267 | ||
267 | void ComposeMail::pickAddressTo() | 268 | void ComposeMail::pickAddressTo() |
268 | { | 269 | { |
269 | mPickLineEdit = toLine; | 270 | mPickLineEdit = toLine; |
270 | pickAddress( ); | 271 | pickAddress( ); |
271 | } | 272 | } |
272 | 273 | ||
273 | void ComposeMail::pickAddressCC() | 274 | void ComposeMail::pickAddressCC() |
274 | { | 275 | { |
275 | mPickLineEdit = ccLine; | 276 | mPickLineEdit = ccLine; |
276 | pickAddress( ); | 277 | pickAddress( ); |
277 | } | 278 | } |
278 | 279 | ||
279 | void ComposeMail::pickAddressBCC() | 280 | void ComposeMail::pickAddressBCC() |
280 | { | 281 | { |
281 | mPickLineEdit = bccLine; | 282 | mPickLineEdit = bccLine; |
282 | pickAddress( ); | 283 | pickAddress( ); |
283 | } | 284 | } |
284 | 285 | ||
285 | void ComposeMail::pickAddressReply() | 286 | void ComposeMail::pickAddressReply() |
286 | { | 287 | { |
287 | mPickLineEdit = replyLine; | 288 | mPickLineEdit = replyLine; |
288 | pickAddress( ); | 289 | pickAddress( ); |
289 | } | 290 | } |
290 | 291 | ||
291 | void ComposeMail::fillValues( int ) | 292 | void ComposeMail::fillValues( int ) |
292 | { | 293 | { |
293 | #if 0 | 294 | #if 0 |
294 | SMTPaccount *smtp = smtpAccounts.at( current ); | 295 | SMTPaccount *smtp = smtpAccounts.at( current ); |
295 | ccLine->clear(); | 296 | ccLine->clear(); |
296 | if ( smtp->getUseCC() ) { | 297 | if ( smtp->getUseCC() ) { |
297 | ccLine->setText( smtp->getCC() ); | 298 | ccLine->setText( smtp->getCC() ); |
298 | } | 299 | } |
299 | bccLine->clear(); | 300 | bccLine->clear(); |
300 | if ( smtp->getUseBCC() ) { | 301 | if ( smtp->getUseBCC() ) { |
301 | bccLine->setText( smtp->getBCC() ); | 302 | bccLine->setText( smtp->getBCC() ); |
302 | } | 303 | } |
303 | replyLine->clear(); | 304 | replyLine->clear(); |
304 | if ( smtp->getUseReply() ) { | 305 | if ( smtp->getUseReply() ) { |
305 | replyLine->setText( smtp->getReply() ); | 306 | replyLine->setText( smtp->getReply() ); |
306 | } | 307 | } |
307 | sigMultiLine->setText( smtp->getSignature() ); | 308 | sigMultiLine->setText( smtp->getSignature() ); |
308 | #endif | 309 | #endif |
309 | } | 310 | } |
310 | 311 | ||
311 | void ComposeMail::slotAdjustColumns() | 312 | void ComposeMail::slotAdjustColumns() |
312 | { | 313 | { |
313 | int currPage = tabWidget->currentPageIndex(); | 314 | int currPage = tabWidget->currentPageIndex(); |
314 | 315 | ||
315 | tabWidget->showPage( attachTab ); | 316 | tabWidget->showPage( attachTab ); |
316 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 317 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
317 | attList->setColumnWidth( 1, 80 ); | 318 | attList->setColumnWidth( 1, 80 ); |
318 | 319 | ||
319 | tabWidget->setCurrentPage( currPage ); | 320 | tabWidget->setCurrentPage( currPage ); |
320 | } | 321 | } |
321 | 322 | ||
322 | void ComposeMail::addAttachment() | 323 | void ComposeMail::addAttachment() |
323 | { | 324 | { |
324 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); | 325 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); |
325 | if ( !lnk.isEmpty() ) { | 326 | if ( !lnk.isEmpty() ) { |
326 | Attachment *att = new Attachment( lnk ); | 327 | Attachment *att = new Attachment( lnk ); |
327 | (void) new AttachViewItem( attList, att ); | 328 | (void) new AttachViewItem( attList, att ); |
328 | } | 329 | } |
329 | } | 330 | } |
330 | 331 | ||
331 | void ComposeMail::removeAttachment() | 332 | void ComposeMail::removeAttachment() |
332 | { | 333 | { |
333 | if ( !attList->currentItem() ) { | 334 | if ( !attList->currentItem() ) { |
334 | QMessageBox::information( this, tr( "Error" ), | 335 | QMessageBox::information( this, tr( "Error" ), |
335 | tr( "<p>Please select a File.</p>" ), | 336 | tr( "<p>Please select a File.</p>" ), |
336 | tr( "Ok" ) ); | 337 | tr( "Ok" ) ); |
337 | } else { | 338 | } else { |
338 | attList->takeItem( attList->currentItem() ); | 339 | attList->takeItem( attList->currentItem() ); |
339 | } | 340 | } |
340 | } | 341 | } |
341 | 342 | ||
342 | void ComposeMail::accept() | 343 | void ComposeMail::accept() |
343 | { | 344 | { |
344 | if ( smtpAccountBox->count() == 0 ) { | 345 | if ( smtpAccountBox->count() == 0 ) { |
345 | 346 | ||
346 | reject(); | 347 | reject(); |
347 | return; | 348 | return; |
348 | } | 349 | } |
349 | 350 | ||
350 | if (! checkBoxLater->isChecked() ) { | 351 | if (! checkBoxLater->isChecked() ) { |
351 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), | 352 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), |
352 | tr("Send this message?"), | 353 | tr("Send this message?"), |
353 | tr("Yes"), | 354 | tr("Yes"), |
354 | tr("Cancel")); | 355 | tr("Cancel")); |
355 | 356 | ||
356 | if (yesno == 1) { | 357 | if (yesno == 1) { |
357 | return; | 358 | return; |
358 | } | 359 | } |
359 | } | 360 | } |
360 | #if 0 | 361 | #if 0 |
361 | odebug << "Sending Mail with " | 362 | odebug << "Sending Mail with " |
362 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; | 363 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; |
363 | #endif | 364 | #endif |
364 | Opie::Core::OSmartPointer<Mail> mail=new Mail; | 365 | Opie::Core::OSmartPointer<Mail> mail=new Mail; |
365 | 366 | ||
366 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 367 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
367 | mail->setMail(fromBox->currentText()); | 368 | mail->setMail(fromBox->currentText()); |
368 | 369 | ||
369 | if ( !toLine->text().isEmpty() ) { | 370 | if ( !toLine->text().isEmpty() ) { |
370 | mail->setTo( toLine->text() ); | 371 | mail->setTo( toLine->text() ); |
371 | } else { | 372 | } else { |
372 | QMessageBox::warning(0,tr("Sending mail"), | 373 | QMessageBox::warning(0,tr("Sending mail"), |
373 | tr("No Receiver spezified" ) ); | 374 | tr("No Receiver spezified" ) ); |
374 | return; | 375 | return; |
375 | } | 376 | } |
376 | 377 | ||
377 | mail->setName(senderNameEdit->text()); | 378 | mail->setName(senderNameEdit->text()); |
378 | mail->setCC( ccLine->text() ); | 379 | mail->setCC( ccLine->text() ); |
379 | mail->setBCC( bccLine->text() ); | 380 | mail->setBCC( bccLine->text() ); |
380 | mail->setReply( replyLine->text() ); | 381 | mail->setReply( replyLine->text() ); |
381 | mail->setSubject( subjectLine->text() ); | 382 | mail->setSubject( subjectLine->text() ); |
382 | if (!m_replyid.isEmpty()) { | 383 | if (!m_replyid.isEmpty()) { |
383 | QStringList ids; | 384 | QStringList ids; |
384 | ids.append(m_replyid); | 385 | ids.append(m_replyid); |
385 | mail->setInreply(ids); | 386 | mail->setInreply(ids); |
386 | } | 387 | } |
387 | QString txt = message->text(); | 388 | QString txt = message->text(); |
388 | if ( !sigMultiLine->text().isEmpty() ) { | 389 | if ( !sigMultiLine->text().isEmpty() ) { |
389 | txt.append( "\n--\n" ); | 390 | txt.append( "\n--\n" ); |
390 | txt.append( sigMultiLine->text() ); | 391 | txt.append( sigMultiLine->text() ); |
391 | } | 392 | } |
392 | mail->setMessage( txt ); | 393 | mail->setMessage( txt ); |
393 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 394 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
394 | while ( it != 0 ) { | 395 | while ( it != 0 ) { |
395 | mail->addAttachment( it->getAttachment() ); | 396 | mail->addAttachment( it->getAttachment() ); |
396 | it = (AttachViewItem *) it->nextSibling(); | 397 | it = (AttachViewItem *) it->nextSibling(); |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 0c581c0..b2119e6 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,327 +1,343 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | 3 | ||
4 | #include "settingsdialog.h" | 4 | #include "settingsdialog.h" |
5 | #include "opiemail.h" | 5 | #include "opiemail.h" |
6 | #include "editaccounts.h" | 6 | #include "editaccounts.h" |
7 | #include "composemail.h" | 7 | #include "composemail.h" |
8 | #include "mailistviewitem.h" | 8 | #include "mailistviewitem.h" |
9 | #include "viewmail.h" | 9 | #include "viewmail.h" |
10 | #include "selectstore.h" | 10 | #include "selectstore.h" |
11 | #include "selectsmtp.h" | 11 | #include "selectsmtp.h" |
12 | 12 | ||
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | #include <qtimer.h> | ||
14 | #include <libkdepim/externalapphandler.h> | 15 | #include <libkdepim/externalapphandler.h> |
15 | 16 | ||
16 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
17 | #include <libmailwrapper/smtpwrapper.h> | 18 | #include <libmailwrapper/smtpwrapper.h> |
18 | #include <libmailwrapper/mailtypes.h> | 19 | #include <libmailwrapper/mailtypes.h> |
19 | #include <libmailwrapper/abstractmail.h> | 20 | #include <libmailwrapper/abstractmail.h> |
20 | /* OPIE */ | 21 | /* OPIE */ |
21 | //#include <qpe/resource.h> | 22 | //#include <qpe/resource.h> |
22 | //#include <qpe/qpeapplication.h> | 23 | //#include <qpe/qpeapplication.h> |
23 | 24 | ||
24 | /* QT */ | 25 | /* QT */ |
25 | 26 | ||
26 | //using namespace Opie::Core; | 27 | //using namespace Opie::Core; |
27 | 28 | ||
28 | OpieMail::OpieMail( QWidget *parent, const char *name ) | 29 | OpieMail::OpieMail( QWidget *parent, const char *name ) |
29 | : MainWindow( parent, name) //, WStyle_ContextHelp ) | 30 | : MainWindow( parent, name) //, WStyle_ContextHelp ) |
30 | { | 31 | { |
31 | settings = new Settings(); | 32 | settings = new Settings(); |
32 | 33 | ||
33 | folderView->populate( settings->getAccounts() ); | 34 | folderView->populate( settings->getAccounts() ); |
34 | 35 | ||
35 | } | 36 | } |
36 | 37 | ||
37 | OpieMail::~OpieMail() | 38 | OpieMail::~OpieMail() |
38 | { | 39 | { |
39 | if (settings) delete settings; | 40 | if (settings) delete settings; |
40 | } | 41 | } |
41 | 42 | ||
42 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 43 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
43 | { | 44 | { |
44 | 45 | ||
45 | } | 46 | } |
46 | #include <stdlib.h> | 47 | #include <stdlib.h> |
47 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 48 | void OpieMail::message(const QCString &msg, const QByteArray &data) |
48 | { | 49 | { |
49 | // copied from old mail2 | 50 | // copied from old mail2 |
50 | static int ii = 0; | 51 | static int ii = 0; |
51 | qDebug("call ############################# %d ", ii); | 52 | //qDebug("QCOP CALL ############################# %d ", ii); |
52 | // block second call | 53 | //QString mess ( msg ); |
53 | if ( ii < 2 ) { | 54 | //qDebug("Message = %s ",mess.latin1()); |
54 | //++ii; | ||
55 | if ( ii > 1 ) { | ||
56 | qDebug("qcop call blocked "); | ||
57 | //return; | ||
58 | } | ||
59 | } | ||
60 | ++ii; | 55 | ++ii; |
61 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 56 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
57 | |||
58 | mPendingEmail = QString::null; | ||
59 | mPendingName = QString::null; | ||
62 | if (msg == "writeMail(QString,QString)") | 60 | if (msg == "writeMail(QString,QString)") |
63 | { | 61 | { |
62 | //qDebug("writeMail(QString,QString) "); | ||
64 | QDataStream stream(data,IO_ReadOnly); | 63 | QDataStream stream(data,IO_ReadOnly); |
65 | QString name, email; | 64 | stream >> mPendingName >> mPendingEmail; |
66 | stream >> name >> email; | ||
67 | // removing the whitespaces at beginning and end is needed! | 65 | // removing the whitespaces at beginning and end is needed! |
68 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); | 66 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
69 | } | 67 | } |
70 | else if (msg == "newMail()") | 68 | else if (msg == "newMail()") |
71 | { | 69 | { |
72 | slotComposeMail(); | 70 | //qDebug("slotComposeMail() "); |
71 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call | ||
72 | // and a QCOP call does not like a processevents in his execution | ||
73 | // with the Qtimer we call slotComposeMail() after we reached the main event loop | ||
74 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | ||
75 | // slotComposeMail(); | ||
73 | } | 76 | } |
74 | else if (msg == "newMail(QString)") | 77 | else if (msg == "newMail(QString)") |
75 | { | 78 | { |
79 | //qDebug(" newMail(QString)"); | ||
76 | QDataStream stream(data,IO_ReadOnly); | 80 | QDataStream stream(data,IO_ReadOnly); |
77 | QString nameemail; | 81 | stream >> mPendingName; |
78 | stream >> nameemail; | ||
79 | // the format is | 82 | // the format is |
80 | // NAME <EMAIL>:SUBJECT | 83 | // NAME <EMAIL>:SUBJECT |
81 | //qDebug("message %s ", nameemail.latin1()); | 84 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
82 | 85 | } else { | |
83 | slotwriteMail2( nameemail ); | 86 | if ( ii == 1 ) { |
84 | } else | 87 | qDebug("Kopiemail::Error:: Initial QCOP call for ExternalAppHandler not supported "); |
85 | ExternalAppHandler::instance()->appMessage ( msg, data); | 88 | return; |
89 | } | ||
90 | ExternalAppHandler::instance()->appMessage ( msg, data); | ||
91 | } | ||
92 | |||
93 | //qDebug("END OpieMail::message "); | ||
86 | } | 94 | } |
87 | void OpieMail::slotwriteMail2(const QString& namemail ) | 95 | void OpieMail::slotwriteMail2(const QString& namemail ) |
88 | { | 96 | { |
89 | // qDebug("OpieMail::slotwriteMail2 "); | 97 | //qDebug("OpieMail::slotwriteMail2 "); |
90 | qApp->processEvents(); | 98 | //qApp->processEvents(); |
91 | ComposeMail compose( settings, this, 0, true ); | 99 | ComposeMail compose( settings, this, 0, true ); |
92 | if ( !namemail.isEmpty() ) { | 100 | if ( !namemail.isEmpty() ) { |
93 | QString to = namemail; | 101 | QString to = namemail; |
94 | if ( namemail.find( " <") > 1 ) { | 102 | if ( namemail.find( " <") > 1 ) { |
95 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 103 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
96 | } else | 104 | } else |
97 | if ( namemail.find( "<") > 1 ) { | 105 | if ( namemail.find( "<") > 1 ) { |
98 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 106 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
99 | } | 107 | } |
100 | int sub = to.find( ">:"); | 108 | int sub = to.find( ">:"); |
101 | if ( sub > 0 ) { | 109 | if ( sub > 0 ) { |
102 | compose.setTo( to.left(sub+1) ); | 110 | compose.setTo( to.left(sub+1) ); |
103 | compose.setSubject( to.mid(sub+2) ); | 111 | compose.setSubject( to.mid(sub+2) ); |
104 | } else | 112 | } else |
105 | compose.setTo( to ); | 113 | compose.setTo( to ); |
106 | } | 114 | } |
107 | compose.slotAdjustColumns(); | 115 | compose.slotAdjustColumns(); |
108 | compose.showMaximized(); | 116 | compose.showMaximized(); |
109 | compose.exec(); | 117 | compose.exec(); |
110 | raise(); | 118 | raise(); |
111 | //qDebug("retttich "); | 119 | //qDebug("retttich "); |
112 | } | 120 | } |
113 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 121 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
114 | { | 122 | { |
115 | // qDebug("OpieMail::slotwriteMail "); | 123 | // qDebug("OpieMail::slotwriteMail "); |
116 | ComposeMail compose( settings, this, 0, true ); | 124 | ComposeMail compose( settings, this, 0, true ); |
117 | if (!email.isEmpty()) | 125 | if (!email.isEmpty()) |
118 | { | 126 | { |
119 | if (!name.isEmpty()) | 127 | if (!name.isEmpty()) |
120 | { | 128 | { |
121 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 129 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
122 | } | 130 | } |
123 | else | 131 | else |
124 | { | 132 | { |
125 | compose.setTo(email); | 133 | compose.setTo(email); |
126 | } | 134 | } |
127 | } | 135 | } |
128 | compose.slotAdjustColumns(); | 136 | compose.slotAdjustColumns(); |
129 | compose.showMaximized(); | 137 | compose.showMaximized(); |
130 | compose.exec(); | 138 | compose.exec(); |
139 | raise(); | ||
131 | } | 140 | } |
132 | 141 | ||
133 | void OpieMail::slotComposeMail() | 142 | void OpieMail::slotComposeMail() |
134 | { | 143 | { |
135 | slotwriteMail2( QString () ); | 144 | if ( mPendingEmail == QString::null && mPendingName == QString::null) |
145 | slotwriteMail2( QString () ); | ||
146 | else { | ||
147 | if ( mPendingEmail == QString::null ) | ||
148 | slotwriteMail2( mPendingName ); | ||
149 | else | ||
150 | slotwriteMail( mPendingName, mPendingEmail ); | ||
151 | } | ||
136 | //slotwriteMail(0l,0l); | 152 | //slotwriteMail(0l,0l); |
137 | } | 153 | } |
138 | 154 | ||
139 | void OpieMail::slotSendQueued() | 155 | void OpieMail::slotSendQueued() |
140 | { | 156 | { |
141 | SMTPaccount *smtp = 0; | 157 | SMTPaccount *smtp = 0; |
142 | 158 | ||
143 | QList<Account> list = settings->getAccounts(); | 159 | QList<Account> list = settings->getAccounts(); |
144 | QList<SMTPaccount> smtpList; | 160 | QList<SMTPaccount> smtpList; |
145 | smtpList.setAutoDelete(false); | 161 | smtpList.setAutoDelete(false); |
146 | Account *it; | 162 | Account *it; |
147 | for ( it = list.first(); it; it = list.next() ) | 163 | for ( it = list.first(); it; it = list.next() ) |
148 | { | 164 | { |
149 | if ( it->getType() == MAILLIB::A_SMTP ) | 165 | if ( it->getType() == MAILLIB::A_SMTP ) |
150 | { | 166 | { |
151 | smtp = static_cast<SMTPaccount *>(it); | 167 | smtp = static_cast<SMTPaccount *>(it); |
152 | smtpList.append(smtp); | 168 | smtpList.append(smtp); |
153 | } | 169 | } |
154 | } | 170 | } |
155 | if (smtpList.count()==0) | 171 | if (smtpList.count()==0) |
156 | { | 172 | { |
157 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); | 173 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); |
158 | return; | 174 | return; |
159 | } | 175 | } |
160 | if (smtpList.count()==1) | 176 | if (smtpList.count()==1) |
161 | { | 177 | { |
162 | smtp = smtpList.at(0); | 178 | smtp = smtpList.at(0); |
163 | } | 179 | } |
164 | else | 180 | else |
165 | { | 181 | { |
166 | smtp = 0; | 182 | smtp = 0; |
167 | selectsmtp selsmtp; | 183 | selectsmtp selsmtp; |
168 | selsmtp.setSelectionlist(&smtpList); | 184 | selsmtp.setSelectionlist(&smtpList); |
169 | selsmtp.showMaximized(); | 185 | selsmtp.showMaximized(); |
170 | if ( selsmtp.exec() == QDialog::Accepted ) | 186 | if ( selsmtp.exec() == QDialog::Accepted ) |
171 | { | 187 | { |
172 | smtp = selsmtp.selected_smtp(); | 188 | smtp = selsmtp.selected_smtp(); |
173 | } | 189 | } |
174 | } | 190 | } |
175 | if (smtp) | 191 | if (smtp) |
176 | { | 192 | { |
177 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 193 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
178 | if ( wrap->flushOutbox() ) | 194 | if ( wrap->flushOutbox() ) |
179 | { | 195 | { |
180 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 196 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
181 | } | 197 | } |
182 | delete wrap; | 198 | delete wrap; |
183 | } | 199 | } |
184 | } | 200 | } |
185 | 201 | ||
186 | void OpieMail::slotSearchMails() | 202 | void OpieMail::slotSearchMails() |
187 | { | 203 | { |
188 | qDebug("OpieMail::slotSearchMails():not implemented "); | 204 | qDebug("OpieMail::slotSearchMails():not implemented "); |
189 | } | 205 | } |
190 | 206 | ||
191 | void OpieMail::slotEditSettings() | 207 | void OpieMail::slotEditSettings() |
192 | { | 208 | { |
193 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 209 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
194 | settingsDialog.showMaximized(); | 210 | settingsDialog.showMaximized(); |
195 | settingsDialog.exec(); | 211 | settingsDialog.exec(); |
196 | } | 212 | } |
197 | 213 | ||
198 | void OpieMail::slotEditAccounts() | 214 | void OpieMail::slotEditAccounts() |
199 | { | 215 | { |
200 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 216 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); |
201 | eaDialog.slotAdjustColumns(); | 217 | eaDialog.slotAdjustColumns(); |
202 | eaDialog.showMaximized(); | 218 | eaDialog.showMaximized(); |
203 | eaDialog.exec(); | 219 | eaDialog.exec(); |
204 | if ( settings ) delete settings; | 220 | if ( settings ) delete settings; |
205 | settings = new Settings(); | 221 | settings = new Settings(); |
206 | 222 | ||
207 | folderView->populate( settings->getAccounts() ); | 223 | folderView->populate( settings->getAccounts() ); |
208 | } | 224 | } |
209 | 225 | ||
210 | void OpieMail::displayMail() | 226 | void OpieMail::displayMail() |
211 | { | 227 | { |
212 | QListViewItem*item = mailView->currentItem(); | 228 | QListViewItem*item = mailView->currentItem(); |
213 | if (!item) return; | 229 | if (!item) return; |
214 | RecMailP mail = ((MailListViewItem*)item)->data(); | 230 | RecMailP mail = ((MailListViewItem*)item)->data(); |
215 | RecBodyP body = folderView->fetchBody(mail); | 231 | RecBodyP body = folderView->fetchBody(mail); |
216 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); | 232 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); |
217 | readMail.setBody( body ); | 233 | readMail.setBody( body ); |
218 | readMail.setMail( mail ); | 234 | readMail.setMail( mail ); |
219 | readMail.showMaximized(); | 235 | readMail.showMaximized(); |
220 | readMail.exec(); | 236 | readMail.exec(); |
221 | 237 | ||
222 | if ( readMail.deleted ) | 238 | if ( readMail.deleted ) |
223 | { | 239 | { |
224 | folderView->refreshCurrent(); | 240 | folderView->refreshCurrent(); |
225 | } | 241 | } |
226 | else | 242 | else |
227 | { | 243 | { |
228 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 244 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
229 | } | 245 | } |
230 | } | 246 | } |
231 | 247 | ||
232 | void OpieMail::slotDeleteMail() | 248 | void OpieMail::slotDeleteMail() |
233 | { | 249 | { |
234 | if (!mailView->currentItem()) return; | 250 | if (!mailView->currentItem()) return; |
235 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 251 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
236 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 252 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
237 | { | 253 | { |
238 | mail->Wrapper()->deleteMail( mail ); | 254 | mail->Wrapper()->deleteMail( mail ); |
239 | folderView->refreshCurrent(); | 255 | folderView->refreshCurrent(); |
240 | } | 256 | } |
241 | } | 257 | } |
242 | void OpieMail::slotDeleteAllMail() | 258 | void OpieMail::slotDeleteAllMail() |
243 | { | 259 | { |
244 | 260 | ||
245 | QValueList<RecMailP> t; | 261 | QValueList<RecMailP> t; |
246 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 262 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
247 | { | 263 | { |
248 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 264 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
249 | while ( item ) { | 265 | while ( item ) { |
250 | if ( item->isSelected() ) { | 266 | if ( item->isSelected() ) { |
251 | t.append( item->data() ); | 267 | t.append( item->data() ); |
252 | } | 268 | } |
253 | item = (MailListViewItem*)item->nextSibling(); | 269 | item = (MailListViewItem*)item->nextSibling(); |
254 | } | 270 | } |
255 | } | 271 | } |
256 | else | 272 | else |
257 | return; | 273 | return; |
258 | if ( t.count() == 0 ) | 274 | if ( t.count() == 0 ) |
259 | return; | 275 | return; |
260 | RecMailP mail = t.first(); | 276 | RecMailP mail = t.first(); |
261 | mail->Wrapper()->deleteMailList(t); | 277 | mail->Wrapper()->deleteMailList(t); |
262 | folderView->refreshCurrent(); | 278 | folderView->refreshCurrent(); |
263 | 279 | ||
264 | 280 | ||
265 | } | 281 | } |
266 | void OpieMail::clearSelection() | 282 | void OpieMail::clearSelection() |
267 | { | 283 | { |
268 | mailView->clearSelection(); | 284 | mailView->clearSelection(); |
269 | 285 | ||
270 | } | 286 | } |
271 | 287 | ||
272 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 288 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
273 | { | 289 | { |
274 | if (!mailView->currentItem()) return; | 290 | if (!mailView->currentItem()) return; |
275 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 291 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
276 | /* just the RIGHT button - or hold on pda */ | 292 | /* just the RIGHT button - or hold on pda */ |
277 | if (button!=2) {return;} | 293 | if (button!=2) {return;} |
278 | if (!item) return; | 294 | if (!item) return; |
279 | QPopupMenu *m = new QPopupMenu(0); | 295 | QPopupMenu *m = new QPopupMenu(0); |
280 | if (m) | 296 | if (m) |
281 | { | 297 | { |
282 | if (mailtype==MAILLIB::A_NNTP) { | 298 | if (mailtype==MAILLIB::A_NNTP) { |
283 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 299 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
284 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 300 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
285 | } else { | 301 | } else { |
286 | if (folderView->currentisDraft()) { | 302 | if (folderView->currentisDraft()) { |
287 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | 303 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); |
288 | } | 304 | } |
289 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 305 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
290 | m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); | 306 | m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); |
291 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 307 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
292 | m->insertSeparator(); | 308 | m->insertSeparator(); |
293 | m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); | 309 | m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); |
294 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 310 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
295 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); | 311 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); |
296 | } | 312 | } |
297 | m->setFocus(); | 313 | m->setFocus(); |
298 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 314 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
299 | delete m; | 315 | delete m; |
300 | } | 316 | } |
301 | } | 317 | } |
302 | 318 | ||
303 | void OpieMail::slotShowFolders( bool show ) | 319 | void OpieMail::slotShowFolders( bool show ) |
304 | { | 320 | { |
305 | if ( show && folderView->isHidden() ) | 321 | if ( show && folderView->isHidden() ) |
306 | { | 322 | { |
307 | folderView->show(); | 323 | folderView->show(); |
308 | } | 324 | } |
309 | else if ( !show && !folderView->isHidden() ) | 325 | else if ( !show && !folderView->isHidden() ) |
310 | { | 326 | { |
311 | folderView->hide(); | 327 | folderView->hide(); |
312 | } | 328 | } |
313 | } | 329 | } |
314 | 330 | ||
315 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 331 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
316 | { | 332 | { |
317 | MailListViewItem*item = 0; | 333 | MailListViewItem*item = 0; |
318 | mailView->clear(); | 334 | mailView->clear(); |
319 | 335 | ||
320 | QValueList<RecMailP>::ConstIterator it; | 336 | QValueList<RecMailP>::ConstIterator it; |
321 | for (it = list.begin(); it != list.end();++it) | 337 | for (it = list.begin(); it != list.end();++it) |
322 | { | 338 | { |
323 | item = new MailListViewItem(mailView,item); | 339 | item = new MailListViewItem(mailView,item); |
324 | item->storeData((*it)); | 340 | item->storeData((*it)); |
325 | item->showEntry(); | 341 | item->showEntry(); |
326 | } | 342 | } |
327 | } | 343 | } |
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h index 7434e59..1de5f6b 100644 --- a/kmicromail/opiemail.h +++ b/kmicromail/opiemail.h | |||
@@ -1,48 +1,50 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef OPIEMAIL_H | 2 | #ifndef OPIEMAIL_H |
3 | #define OPIEMAIL_H | 3 | #define OPIEMAIL_H |
4 | 4 | ||
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | #include <libmailwrapper/settings.h> | 6 | #include <libmailwrapper/settings.h> |
7 | 7 | ||
8 | #include <opie2/osmartpointer.h> | 8 | #include <opie2/osmartpointer.h> |
9 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
10 | 10 | ||
11 | class OpieMail : public MainWindow | 11 | class OpieMail : public MainWindow |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | 14 | ||
15 | public: | 15 | public: |
16 | OpieMail( QWidget *parent = 0, const char *name = 0 ); | 16 | OpieMail( QWidget *parent = 0, const char *name = 0 ); |
17 | virtual ~OpieMail(); | 17 | virtual ~OpieMail(); |
18 | static QString appName() { return QString::fromLatin1("kopiemail"); } | 18 | static QString appName() { return QString::fromLatin1("kopiemail"); } |
19 | 19 | ||
20 | public slots: | 20 | public slots: |
21 | virtual void slotwriteMail(const QString&name,const QString&email); | 21 | virtual void slotwriteMail(const QString&name,const QString&email); |
22 | virtual void slotwriteMail2(const QString&nameemail); | 22 | virtual void slotwriteMail2(const QString&nameemail); |
23 | virtual void slotComposeMail(); | 23 | virtual void slotComposeMail(); |
24 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 24 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
25 | virtual void message(const QCString &msg, const QByteArray &data); | 25 | virtual void message(const QCString &msg, const QByteArray &data); |
26 | protected slots: | 26 | protected slots: |
27 | virtual void slotSendQueued(); | 27 | virtual void slotSendQueued(); |
28 | virtual void slotSearchMails(); | 28 | virtual void slotSearchMails(); |
29 | virtual void slotEditSettings(); | 29 | virtual void slotEditSettings(); |
30 | virtual void slotEditAccounts(); | 30 | virtual void slotEditAccounts(); |
31 | virtual void displayMail(); | 31 | virtual void displayMail(); |
32 | virtual void slotDeleteMail(); | 32 | virtual void slotDeleteMail(); |
33 | virtual void slotDeleteAllMail(); | 33 | virtual void slotDeleteAllMail(); |
34 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 34 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
35 | virtual void slotShowFolders( bool show ); | 35 | virtual void slotShowFolders( bool show ); |
36 | virtual void refreshMailView(const QValueList<RecMailP>&); | 36 | virtual void refreshMailView(const QValueList<RecMailP>&); |
37 | virtual void mailLeftClicked( QListViewItem * ); | 37 | virtual void mailLeftClicked( QListViewItem * ); |
38 | virtual void slotMoveCopyMail(); | 38 | virtual void slotMoveCopyMail(); |
39 | virtual void slotMoveCopyAllMail(); | 39 | virtual void slotMoveCopyAllMail(); |
40 | virtual void reEditMail(); | 40 | virtual void reEditMail(); |
41 | void clearSelection(); | 41 | void clearSelection(); |
42 | 42 | ||
43 | private: | 43 | private: |
44 | QString mPendingEmail; | ||
45 | QString mPendingName; | ||
44 | Settings *settings; | 46 | Settings *settings; |
45 | 47 | ||
46 | }; | 48 | }; |
47 | 49 | ||
48 | #endif | 50 | #endif |