-rw-r--r-- | kabc/stdaddressbook.cpp | 12 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 22 | ||||
-rw-r--r-- | kmicromail/composemail.cpp | 99 | ||||
-rw-r--r-- | kmicromail/composemail.h | 8 | ||||
-rw-r--r-- | kmicromail/main.cpp | 5 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 2 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 1 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 2 |
8 files changed, 121 insertions, 30 deletions
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp index 9f38f08..ec47a4e 100644 --- a/kabc/stdaddressbook.cpp +++ b/kabc/stdaddressbook.cpp | |||
@@ -1,236 +1,224 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include "resource.h" | 29 | #include "resource.h" |
30 | #include <kresources/manager.h> | 30 | #include <kresources/manager.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | #include <kstaticdeleter.h> | 33 | #include <kstaticdeleter.h> |
34 | #include <kstandarddirs.h> | 34 | #include <kstandarddirs.h> |
35 | 35 | ||
36 | #include "stdaddressbook.h" | 36 | #include "stdaddressbook.h" |
37 | 37 | ||
38 | using namespace KABC; | 38 | using namespace KABC; |
39 | 39 | ||
40 | StdAddressBook *StdAddressBook::mSelf = 0; | 40 | StdAddressBook *StdAddressBook::mSelf = 0; |
41 | bool StdAddressBook::mAutomaticSave = true; | 41 | bool StdAddressBook::mAutomaticSave = true; |
42 | 42 | ||
43 | static KStaticDeleter<StdAddressBook> addressBookDeleter; | 43 | static KStaticDeleter<StdAddressBook> addressBookDeleter; |
44 | 44 | ||
45 | QString StdAddressBook::fileName() | 45 | QString StdAddressBook::fileName() |
46 | { | 46 | { |
47 | return locateLocal( "data", "kabc/std.vcf" ); | 47 | return locateLocal( "data", "kabc/std.vcf" ); |
48 | } | 48 | } |
49 | 49 | ||
50 | QString StdAddressBook::directoryName() | 50 | QString StdAddressBook::directoryName() |
51 | { | 51 | { |
52 | return locateLocal( "data", "kabc/stdvcf" ); | 52 | return locateLocal( "data", "kabc/stdvcf" ); |
53 | } | 53 | } |
54 | 54 | ||
55 | void StdAddressBook::handleCrash() | 55 | void StdAddressBook::handleCrash() |
56 | { | 56 | { |
57 | StdAddressBook::self()->cleanUp(); | 57 | StdAddressBook::self()->cleanUp(); |
58 | } | 58 | } |
59 | 59 | ||
60 | StdAddressBook *StdAddressBook::self() | 60 | StdAddressBook *StdAddressBook::self() |
61 | { | 61 | { |
62 | 62 | ||
63 | if ( !mSelf ) | 63 | if ( !mSelf ) |
64 | { | 64 | { |
65 | QString appdir = StdAddressBook::setTempAppDir(); | 65 | QString appdir = StdAddressBook::setTempAppDir(); |
66 | qDebug("****************************************************** "); | ||
67 | qDebug("****************************************************** "); | ||
68 | qDebug("****************************************************** "); | ||
69 | qDebug("****************************************************** "); | ||
70 | qDebug("****************************************************** "); | ||
71 | // US im am not sure why I have to use the other format here?? | 66 | // US im am not sure why I have to use the other format here?? |
72 | #ifdef KAB_EMBEDDED | 67 | #ifdef KAB_EMBEDDED |
73 | mSelf = addressBookDeleter.setObject( new StdAddressBook ); | 68 | mSelf = addressBookDeleter.setObject( new StdAddressBook ); |
74 | #else //KAB_EMBEDDED | 69 | #else //KAB_EMBEDDED |
75 | addressBookDeleter.setObject( mSelf, new StdAddressBook ); | 70 | addressBookDeleter.setObject( mSelf, new StdAddressBook ); |
76 | #endif //KAB_EMBEDDED | 71 | #endif //KAB_EMBEDDED |
77 | KStandardDirs::setAppDir( appdir ); | 72 | KStandardDirs::setAppDir( appdir ); |
78 | } | 73 | } |
79 | 74 | ||
80 | return mSelf; | 75 | return mSelf; |
81 | } | 76 | } |
82 | 77 | ||
83 | QString StdAddressBook::setTempAppDir() | 78 | QString StdAddressBook::setTempAppDir() |
84 | { | 79 | { |
85 | QString appDIR = KStandardDirs::appDir(); | 80 | QString appDIR = KStandardDirs::appDir(); |
86 | #ifdef DESKTOP_VERSION | 81 | #ifdef DESKTOP_VERSION |
87 | QString appdir = QDir::homeDirPath(); | 82 | QString appdir = QDir::homeDirPath(); |
88 | if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) | 83 | if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) |
89 | appdir += "kaddressbook/"; | 84 | appdir += "kaddressbook/"; |
90 | else | 85 | else |
91 | appdir += "/kaddressbook/"; | 86 | appdir += "/kaddressbook/"; |
92 | KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); | 87 | KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); |
93 | #else | 88 | #else |
94 | QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook"; | 89 | QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook"; |
95 | 90 | ||
96 | KStandardDirs::setAppDir( appdir ); | 91 | KStandardDirs::setAppDir( appdir ); |
97 | #endif | 92 | #endif |
98 | 93 | ||
99 | return appDIR; | 94 | return appDIR; |
100 | } | 95 | } |
101 | StdAddressBook *StdAddressBook::self( bool onlyFastResources ) | 96 | StdAddressBook *StdAddressBook::self( bool onlyFastResources ) |
102 | { | 97 | { |
103 | 98 | ||
104 | if ( !mSelf ) | 99 | if ( !mSelf ) |
105 | { | 100 | { |
106 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
107 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
108 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
109 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
110 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
111 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
112 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
113 | QString appdir =StdAddressBook::setTempAppDir(); | 101 | QString appdir =StdAddressBook::setTempAppDir(); |
114 | #ifdef KAB_EMBEDDED | 102 | #ifdef KAB_EMBEDDED |
115 | mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); | 103 | mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); |
116 | #else //KAB_EMBEDDED | 104 | #else //KAB_EMBEDDED |
117 | addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) ); | 105 | addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) ); |
118 | #endif //KAB_EMBEDDED | 106 | #endif //KAB_EMBEDDED |
119 | KStandardDirs::setAppDir( appdir ); | 107 | KStandardDirs::setAppDir( appdir ); |
120 | } | 108 | } |
121 | return mSelf; | 109 | return mSelf; |
122 | } | 110 | } |
123 | 111 | ||
124 | StdAddressBook::StdAddressBook() | 112 | StdAddressBook::StdAddressBook() |
125 | : AddressBook( "kabcrc" ) | 113 | : AddressBook( "kabcrc" ) |
126 | { | 114 | { |
127 | 115 | ||
128 | init( false ); | 116 | init( false ); |
129 | } | 117 | } |
130 | 118 | ||
131 | StdAddressBook::StdAddressBook( bool onlyFastResources ) | 119 | StdAddressBook::StdAddressBook( bool onlyFastResources ) |
132 | : AddressBook( "kabcrc" ) | 120 | : AddressBook( "kabcrc" ) |
133 | { | 121 | { |
134 | 122 | ||
135 | init( onlyFastResources ); | 123 | init( onlyFastResources ); |
136 | } | 124 | } |
137 | 125 | ||
138 | StdAddressBook::~StdAddressBook() | 126 | StdAddressBook::~StdAddressBook() |
139 | { | 127 | { |
140 | if ( mAutomaticSave ) | 128 | if ( mAutomaticSave ) |
141 | save(); | 129 | save(); |
142 | } | 130 | } |
143 | 131 | ||
144 | void StdAddressBook::init( bool ) | 132 | void StdAddressBook::init( bool ) |
145 | { | 133 | { |
146 | KRES::Manager<Resource> *manager = resourceManager(); | 134 | KRES::Manager<Resource> *manager = resourceManager(); |
147 | KRES::Manager<Resource>::ActiveIterator it; | 135 | KRES::Manager<Resource>::ActiveIterator it; |
148 | 136 | ||
149 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 137 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
150 | (*it)->setAddressBook( this ); | 138 | (*it)->setAddressBook( this ); |
151 | if ( !(*it)->open() ) | 139 | if ( !(*it)->open() ) |
152 | error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); | 140 | error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); |
153 | } | 141 | } |
154 | 142 | ||
155 | Resource *res = standardResource(); | 143 | Resource *res = standardResource(); |
156 | if ( !res ) { | 144 | if ( !res ) { |
157 | res = manager->createResource( "file" ); | 145 | res = manager->createResource( "file" ); |
158 | if ( res ) | 146 | if ( res ) |
159 | { | 147 | { |
160 | addResource( res ); | 148 | addResource( res ); |
161 | } | 149 | } |
162 | else | 150 | else |
163 | qDebug(" No resource available!!!"); | 151 | qDebug(" No resource available!!!"); |
164 | } | 152 | } |
165 | 153 | ||
166 | setStandardResource( res ); | 154 | setStandardResource( res ); |
167 | manager->writeConfig(); | 155 | manager->writeConfig(); |
168 | 156 | ||
169 | load(); | 157 | load(); |
170 | } | 158 | } |
171 | 159 | ||
172 | bool StdAddressBook::save() | 160 | bool StdAddressBook::save() |
173 | { | 161 | { |
174 | kdDebug(5700) << "StdAddressBook::save()" << endl; | 162 | kdDebug(5700) << "StdAddressBook::save()" << endl; |
175 | 163 | ||
176 | bool ok = true; | 164 | bool ok = true; |
177 | AddressBook *ab = self(); | 165 | AddressBook *ab = self(); |
178 | 166 | ||
179 | ab->deleteRemovedAddressees(); | 167 | ab->deleteRemovedAddressees(); |
180 | 168 | ||
181 | KRES::Manager<Resource>::ActiveIterator it; | 169 | KRES::Manager<Resource>::ActiveIterator it; |
182 | KRES::Manager<Resource> *manager = ab->resourceManager(); | 170 | KRES::Manager<Resource> *manager = ab->resourceManager(); |
183 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 171 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
184 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { | 172 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { |
185 | Ticket *ticket = ab->requestSaveTicket( *it ); | 173 | Ticket *ticket = ab->requestSaveTicket( *it ); |
186 | // qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); | 174 | // qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); |
187 | if ( !ticket ) { | 175 | if ( !ticket ) { |
188 | ab->error( i18n( "Unable to save to resource '%1'. It is locked." ) | 176 | ab->error( i18n( "Unable to save to resource '%1'. It is locked." ) |
189 | .arg( (*it)->resourceName() ) ); | 177 | .arg( (*it)->resourceName() ) ); |
190 | return false; | 178 | return false; |
191 | } | 179 | } |
192 | 180 | ||
193 | if ( !ab->save( ticket ) ) | 181 | if ( !ab->save( ticket ) ) |
194 | ok = false; | 182 | ok = false; |
195 | } | 183 | } |
196 | } | 184 | } |
197 | 185 | ||
198 | return ok; | 186 | return ok; |
199 | } | 187 | } |
200 | 188 | ||
201 | void StdAddressBook::close() | 189 | void StdAddressBook::close() |
202 | { | 190 | { |
203 | //US destructObject is not defined on my system???. Is setObject(0) the same ??? | 191 | //US destructObject is not defined on my system???. Is setObject(0) the same ??? |
204 | //US addressBookDeleter.destructObject(); | 192 | //US addressBookDeleter.destructObject(); |
205 | addressBookDeleter.setObject(0); | 193 | addressBookDeleter.setObject(0); |
206 | 194 | ||
207 | } | 195 | } |
208 | 196 | ||
209 | void StdAddressBook::setAutomaticSave( bool enable ) | 197 | void StdAddressBook::setAutomaticSave( bool enable ) |
210 | { | 198 | { |
211 | mAutomaticSave = enable; | 199 | mAutomaticSave = enable; |
212 | } | 200 | } |
213 | 201 | ||
214 | bool StdAddressBook::automaticSave() | 202 | bool StdAddressBook::automaticSave() |
215 | { | 203 | { |
216 | return mAutomaticSave; | 204 | return mAutomaticSave; |
217 | } | 205 | } |
218 | 206 | ||
219 | // should get const for 4.X | 207 | // should get const for 4.X |
220 | Addressee StdAddressBook::whoAmI() | 208 | Addressee StdAddressBook::whoAmI() |
221 | { | 209 | { |
222 | //US KConfig config( "kabcrc" ); | 210 | //US KConfig config( "kabcrc" ); |
223 | KConfig config( locateLocal("config", "kabcrc") ); | 211 | KConfig config( locateLocal("config", "kabcrc") ); |
224 | config.setGroup( "General" ); | 212 | config.setGroup( "General" ); |
225 | 213 | ||
226 | return findByUid( config.readEntry( "WhoAmI" ) ); | 214 | return findByUid( config.readEntry( "WhoAmI" ) ); |
227 | } | 215 | } |
228 | 216 | ||
229 | void StdAddressBook::setWhoAmI( const Addressee &addr ) | 217 | void StdAddressBook::setWhoAmI( const Addressee &addr ) |
230 | { | 218 | { |
231 | //US KConfig config( "kabcrc" ); | 219 | //US KConfig config( "kabcrc" ); |
232 | KConfig config( locateLocal("config", "kabcrc") ); | 220 | KConfig config( locateLocal("config", "kabcrc") ); |
233 | config.setGroup( "General" ); | 221 | config.setGroup( "General" ); |
234 | 222 | ||
235 | config.writeEntry( "WhoAmI", addr.uid() ); | 223 | config.writeEntry( "WhoAmI", addr.uid() ); |
236 | } | 224 | } |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 2f9f1df..6522ccc 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1918,204 +1918,222 @@ void KABCore::addActionsManually() | |||
1918 | //mActionQuit->plug ( tb ); | 1918 | //mActionQuit->plug ( tb ); |
1919 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1919 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1920 | 1920 | ||
1921 | //US link the searchwidget first to this. | 1921 | //US link the searchwidget first to this. |
1922 | // The real linkage to the toolbar happens later. | 1922 | // The real linkage to the toolbar happens later. |
1923 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1923 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1924 | //US tb->insertItem( mIncSearchWidget ); | 1924 | //US tb->insertItem( mIncSearchWidget ); |
1925 | /*US | 1925 | /*US |
1926 | mIncSearchWidget = new IncSearchWidget( tb ); | 1926 | mIncSearchWidget = new IncSearchWidget( tb ); |
1927 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1927 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1928 | SLOT( incrementalSearch( const QString& ) ) ); | 1928 | SLOT( incrementalSearch( const QString& ) ) ); |
1929 | 1929 | ||
1930 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1930 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1931 | 1931 | ||
1932 | //US topLayout->addWidget( mJumpButtonBar ); | 1932 | //US topLayout->addWidget( mJumpButtonBar ); |
1933 | this->layout()->add( mJumpButtonBar ); | 1933 | this->layout()->add( mJumpButtonBar ); |
1934 | */ | 1934 | */ |
1935 | 1935 | ||
1936 | #endif //KAB_EMBEDDED | 1936 | #endif //KAB_EMBEDDED |
1937 | } | 1937 | } |
1938 | void KABCore::showLicence() | 1938 | void KABCore::showLicence() |
1939 | { | 1939 | { |
1940 | KApplication::showLicence(); | 1940 | KApplication::showLicence(); |
1941 | } | 1941 | } |
1942 | void KABCore::removeVoice() | 1942 | void KABCore::removeVoice() |
1943 | { | 1943 | { |
1944 | 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 ) | 1944 | 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 ) |
1945 | return; | 1945 | return; |
1946 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 1946 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
1947 | KABC::Addressee::List::Iterator it; | 1947 | KABC::Addressee::List::Iterator it; |
1948 | for ( it = list.begin(); it != list.end(); ++it ) { | 1948 | for ( it = list.begin(); it != list.end(); ++it ) { |
1949 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); | 1949 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); |
1950 | PhoneNumber::List::Iterator phoneIt; | 1950 | PhoneNumber::List::Iterator phoneIt; |
1951 | bool found = false; | 1951 | bool found = false; |
1952 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 1952 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
1953 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 1953 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
1954 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 1954 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
1955 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 1955 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
1956 | (*it).insertPhoneNumber( (*phoneIt) ); | 1956 | (*it).insertPhoneNumber( (*phoneIt) ); |
1957 | found = true; | 1957 | found = true; |
1958 | } | 1958 | } |
1959 | } | 1959 | } |
1960 | 1960 | ||
1961 | } | 1961 | } |
1962 | if ( found ) | 1962 | if ( found ) |
1963 | contactModified((*it) ); | 1963 | contactModified((*it) ); |
1964 | } | 1964 | } |
1965 | } | 1965 | } |
1966 | 1966 | ||
1967 | 1967 | ||
1968 | 1968 | ||
1969 | void KABCore::clipboardDataChanged() | 1969 | void KABCore::clipboardDataChanged() |
1970 | { | 1970 | { |
1971 | 1971 | ||
1972 | if ( mReadWrite ) | 1972 | if ( mReadWrite ) |
1973 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1973 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1974 | 1974 | ||
1975 | } | 1975 | } |
1976 | 1976 | ||
1977 | void KABCore::updateActionMenu() | 1977 | void KABCore::updateActionMenu() |
1978 | { | 1978 | { |
1979 | UndoStack *undo = UndoStack::instance(); | 1979 | UndoStack *undo = UndoStack::instance(); |
1980 | RedoStack *redo = RedoStack::instance(); | 1980 | RedoStack *redo = RedoStack::instance(); |
1981 | 1981 | ||
1982 | if ( undo->isEmpty() ) | 1982 | if ( undo->isEmpty() ) |
1983 | mActionUndo->setText( i18n( "Undo" ) ); | 1983 | mActionUndo->setText( i18n( "Undo" ) ); |
1984 | else | 1984 | else |
1985 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 1985 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
1986 | 1986 | ||
1987 | mActionUndo->setEnabled( !undo->isEmpty() ); | 1987 | mActionUndo->setEnabled( !undo->isEmpty() ); |
1988 | 1988 | ||
1989 | if ( !redo->top() ) | 1989 | if ( !redo->top() ) |
1990 | mActionRedo->setText( i18n( "Redo" ) ); | 1990 | mActionRedo->setText( i18n( "Redo" ) ); |
1991 | else | 1991 | else |
1992 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 1992 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
1993 | 1993 | ||
1994 | mActionRedo->setEnabled( !redo->isEmpty() ); | 1994 | mActionRedo->setEnabled( !redo->isEmpty() ); |
1995 | } | 1995 | } |
1996 | 1996 | ||
1997 | void KABCore::configureKeyBindings() | 1997 | void KABCore::configureKeyBindings() |
1998 | { | 1998 | { |
1999 | #ifndef KAB_EMBEDDED | 1999 | #ifndef KAB_EMBEDDED |
2000 | KKeyDialog::configure( actionCollection(), true ); | 2000 | KKeyDialog::configure( actionCollection(), true ); |
2001 | #else //KAB_EMBEDDED | 2001 | #else //KAB_EMBEDDED |
2002 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2002 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2003 | #endif //KAB_EMBEDDED | 2003 | #endif //KAB_EMBEDDED |
2004 | } | 2004 | } |
2005 | 2005 | ||
2006 | #ifdef KAB_EMBEDDED | 2006 | #ifdef KAB_EMBEDDED |
2007 | void KABCore::configureResources() | 2007 | void KABCore::configureResources() |
2008 | { | 2008 | { |
2009 | KRES::KCMKResources dlg( this, "" , 0 ); | 2009 | KRES::KCMKResources dlg( this, "" , 0 ); |
2010 | 2010 | ||
2011 | if ( !dlg.exec() ) | 2011 | if ( !dlg.exec() ) |
2012 | return; | 2012 | return; |
2013 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2013 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2014 | } | 2014 | } |
2015 | #endif //KAB_EMBEDDED | 2015 | #endif //KAB_EMBEDDED |
2016 | 2016 | ||
2017 | 2017 | ||
2018 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2018 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2019 | * for the attendees list of an event. | 2019 | * for the attendees list of an event. |
2020 | */ | 2020 | */ |
2021 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2021 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2022 | { | 2022 | { |
2023 | QStringList nameList; | 2023 | QStringList nameList; |
2024 | QStringList emailList; | 2024 | QStringList emailList; |
2025 | QStringList uidList; | 2025 | QStringList uidList; |
2026 | 2026 | ||
2027 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2027 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2028 | uint i=0; | 2028 | uint i=0; |
2029 | for (i=0; i < list.count(); i++) | 2029 | for (i=0; i < list.count(); i++) |
2030 | { | 2030 | { |
2031 | nameList.append(list[i].realName()); | 2031 | nameList.append(list[i].realName()); |
2032 | emailList.append(list[i].preferredEmail()); | 2032 | emailList.append(list[i].preferredEmail()); |
2033 | uidList.append(list[i].uid()); | 2033 | uidList.append(list[i].uid()); |
2034 | } | 2034 | } |
2035 | 2035 | ||
2036 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2036 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2037 | 2037 | ||
2038 | } | 2038 | } |
2039 | 2039 | ||
2040 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2040 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2041 | */ | 2041 | */ |
2042 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2042 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2043 | { | 2043 | { |
2044 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2044 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2045 | 2045 | ||
2046 | QString foundUid = QString::null; | 2046 | QString foundUid = QString::null; |
2047 | if (uid.isEmpty()) | 2047 | if ( ! uid.isEmpty() ) { |
2048 | Addressee adrr = mAddressBook->findByUid( uid ); | ||
2049 | if ( !adrr.isEmpty() ) { | ||
2050 | foundUid = uid; | ||
2051 | if ( email == "sendbacklist" ) { | ||
2052 | QStringList nameList; | ||
2053 | QStringList emailList; | ||
2054 | QStringList uidList; | ||
2055 | nameList.append(adrr.realName()); | ||
2056 | emailList = adrr.emails(); | ||
2057 | uidList.append( adrr.preferredEmail()); | ||
2058 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | ||
2059 | } | ||
2060 | } | ||
2061 | } | ||
2062 | |||
2063 | if ( email == "sendback" ) | ||
2064 | return; | ||
2065 | if (foundUid.isEmpty()) | ||
2048 | { | 2066 | { |
2049 | //find the uid of the person first | 2067 | //find the uid of the person first |
2050 | Addressee::List namelist; | 2068 | Addressee::List namelist; |
2051 | Addressee::List emaillist; | 2069 | Addressee::List emaillist; |
2052 | 2070 | ||
2053 | if (!name.isEmpty()) | 2071 | if (!name.isEmpty()) |
2054 | namelist = mAddressBook->findByName( name ); | 2072 | namelist = mAddressBook->findByName( name ); |
2055 | 2073 | ||
2056 | if (!email.isEmpty()) | 2074 | if (!email.isEmpty()) |
2057 | emaillist = mAddressBook->findByEmail( email ); | 2075 | emaillist = mAddressBook->findByEmail( email ); |
2058 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2076 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2059 | //check if we have a match in Namelist and Emaillist | 2077 | //check if we have a match in Namelist and Emaillist |
2060 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2078 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2061 | foundUid = emaillist[0].uid(); | 2079 | foundUid = emaillist[0].uid(); |
2062 | } | 2080 | } |
2063 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2081 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2064 | foundUid = namelist[0].uid(); | 2082 | foundUid = namelist[0].uid(); |
2065 | else | 2083 | else |
2066 | { | 2084 | { |
2067 | for (int i = 0; i < namelist.count(); i++) | 2085 | for (int i = 0; i < namelist.count(); i++) |
2068 | { | 2086 | { |
2069 | for (int j = 0; j < emaillist.count(); j++) | 2087 | for (int j = 0; j < emaillist.count(); j++) |
2070 | { | 2088 | { |
2071 | if (namelist[i] == emaillist[j]) | 2089 | if (namelist[i] == emaillist[j]) |
2072 | { | 2090 | { |
2073 | foundUid = namelist[i].uid(); | 2091 | foundUid = namelist[i].uid(); |
2074 | } | 2092 | } |
2075 | } | 2093 | } |
2076 | } | 2094 | } |
2077 | } | 2095 | } |
2078 | } | 2096 | } |
2079 | else | 2097 | else |
2080 | { | 2098 | { |
2081 | foundUid = uid; | 2099 | foundUid = uid; |
2082 | } | 2100 | } |
2083 | 2101 | ||
2084 | if (!foundUid.isEmpty()) | 2102 | if (!foundUid.isEmpty()) |
2085 | { | 2103 | { |
2086 | 2104 | ||
2087 | // raise Ka/Pi if it is in the background | 2105 | // raise Ka/Pi if it is in the background |
2088 | #ifndef DESKTOP_VERSION | 2106 | #ifndef DESKTOP_VERSION |
2089 | #ifndef KORG_NODCOP | 2107 | #ifndef KORG_NODCOP |
2090 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2108 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2091 | #endif | 2109 | #endif |
2092 | #endif | 2110 | #endif |
2093 | 2111 | ||
2094 | mMainWindow->showMaximized(); | 2112 | mMainWindow->showMaximized(); |
2095 | mMainWindow-> raise(); | 2113 | mMainWindow-> raise(); |
2096 | 2114 | ||
2097 | mViewManager->setSelected( "", false); | 2115 | mViewManager->setSelected( "", false); |
2098 | mViewManager->refreshView( "" ); | 2116 | mViewManager->refreshView( "" ); |
2099 | mViewManager->setSelected( foundUid, true ); | 2117 | mViewManager->setSelected( foundUid, true ); |
2100 | mViewManager->refreshView( foundUid ); | 2118 | mViewManager->refreshView( foundUid ); |
2101 | 2119 | ||
2102 | if ( !mMultipleViewsAtOnce ) | 2120 | if ( !mMultipleViewsAtOnce ) |
2103 | { | 2121 | { |
2104 | setDetailsVisible( true ); | 2122 | setDetailsVisible( true ); |
2105 | mActionDetails->setChecked(true); | 2123 | mActionDetails->setChecked(true); |
2106 | } | 2124 | } |
2107 | } | 2125 | } |
2108 | } | 2126 | } |
2109 | 2127 | ||
2110 | 2128 | ||
2111 | void KABCore::faq() | 2129 | void KABCore::faq() |
2112 | { | 2130 | { |
2113 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2131 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2114 | } | 2132 | } |
2115 | 2133 | ||
2116 | 2134 | ||
2117 | 2135 | ||
2118 | 2136 | ||
2119 | #ifndef KAB_EMBEDDED | 2137 | #ifndef KAB_EMBEDDED |
2120 | #include "kabcore.moc" | 2138 | #include "kabcore.moc" |
2121 | #endif //KAB_EMBEDDED | 2139 | #endif //KAB_EMBEDDED |
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 654cfc0..5f446fa 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -1,333 +1,410 @@ | |||
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 | 32 | #ifdef DESKTOP_VERSION | |
33 | #include <kabc/addresseedialog.h> | ||
34 | #else //DESKTOP_VERSION | ||
35 | #include <libkdepim/externalapphandler.h> | ||
36 | #endif //DESKTOP_VERSION | ||
33 | 37 | ||
34 | 38 | ||
35 | //using namespace Opie::Core; | 39 | //using namespace Opie::Core; |
36 | //using namespace Opie::Ui; | 40 | //using namespace Opie::Ui; |
37 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 41 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
38 | : ComposeMailUI( parent, name, modal, flags ) | 42 | : ComposeMailUI( parent, name, modal, flags ) |
39 | { | 43 | { |
40 | 44 | ||
45 | mPickLineEdit = 0; | ||
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&))); | ||
41 | settings = s; | 48 | settings = s; |
42 | m_replyid = ""; | 49 | m_replyid = ""; |
50 | KConfig config( locateLocal("config", "kabcrc") ); | ||
51 | config.setGroup( "General" ); | ||
52 | QString whoami_uid = config.readEntry( "WhoAmI" ); | ||
53 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); | ||
54 | #ifdef DESKTOP_VERSION | ||
43 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); | 55 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); |
44 | QStringList mails = con.emails(); | 56 | QStringList mails = con.emails(); |
45 | QString defmail = con.preferredEmail(); | 57 | QString defmail = con.preferredEmail(); |
46 | if ( mails.count() == 0) | 58 | if ( mails.count() == 0) |
47 | QMessageBox::information( 0, tr( "Hint" ), | 59 | QMessageBox::information( 0, tr( "Hint" ), |
48 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 60 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
49 | tr( "Ok" ) ); | 61 | tr( "Ok" ) ); |
50 | if (defmail.length()!=0) { | 62 | if (defmail.length()!=0) { |
51 | fromBox->insertItem(defmail); | 63 | fromBox->insertItem(defmail); |
52 | } | 64 | } |
53 | QStringList::ConstIterator sit = mails.begin(); | 65 | QStringList::ConstIterator sit = mails.begin(); |
54 | for (;sit!=mails.end();++sit) { | 66 | for (;sit!=mails.end();++sit) { |
55 | if ( (*sit)==defmail) | 67 | if ( (*sit)==defmail) |
56 | continue; | 68 | continue; |
57 | fromBox->insertItem((*sit)); | 69 | fromBox->insertItem((*sit)); |
58 | } | 70 | } |
59 | senderNameEdit->setText(con.formattedName()); | 71 | senderNameEdit->setText(con.formattedName()); |
72 | #endif | ||
60 | Config cfg( "mail" ); | 73 | Config cfg( "mail" ); |
61 | cfg.setGroup( "Compose" ); | 74 | cfg.setGroup( "Compose" ); |
62 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 75 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); |
63 | 76 | ||
64 | attList->addColumn( tr( "Name" ) ); | 77 | attList->addColumn( tr( "Name" ) ); |
65 | attList->addColumn( tr( "Size" ) ); | 78 | attList->addColumn( tr( "Size" ) ); |
66 | 79 | ||
67 | QList<Account> accounts = settings->getAccounts(); | 80 | QList<Account> accounts = settings->getAccounts(); |
68 | 81 | ||
69 | Account *it; | 82 | Account *it; |
70 | for ( it = accounts.first(); it; it = accounts.next() ) { | 83 | for ( it = accounts.first(); it; it = accounts.next() ) { |
71 | if ( it->getType()==MAILLIB::A_SMTP ) { | 84 | if ( it->getType()==MAILLIB::A_SMTP ) { |
72 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 85 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
73 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 86 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
74 | smtpAccounts.append( smtp ); | 87 | smtpAccounts.append( smtp ); |
75 | } | 88 | } |
76 | } | 89 | } |
77 | if ( smtpAccounts.count() > 0 ) { | 90 | if ( smtpAccounts.count() > 0 ) { |
78 | fillValues( smtpAccountBox->currentItem() ); | 91 | fillValues( smtpAccountBox->currentItem() ); |
79 | } else { | 92 | } else { |
80 | QMessageBox::information( 0, tr( "Problem" ), | 93 | QMessageBox::information( 0, tr( "Problem" ), |
81 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), | 94 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), |
82 | tr( "Ok" ) ); | 95 | tr( "Ok" ) ); |
83 | return; | 96 | return; |
84 | } | 97 | } |
85 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 98 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
86 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 99 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
87 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 100 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
88 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 101 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
89 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 102 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
90 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 103 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
91 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 104 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
92 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); | 105 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); |
93 | mMail = 0; | 106 | mMail = 0; |
94 | warnAttach = true; | 107 | warnAttach = true; |
95 | 108 | ||
96 | } | 109 | } |
110 | |||
111 | |||
112 | |||
97 | void ComposeMail::saveAsDraft() | 113 | void ComposeMail::saveAsDraft() |
98 | { | 114 | { |
99 | 115 | ||
100 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); | 116 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); |
101 | mail->setMail(fromBox->currentText()); | 117 | mail->setMail(fromBox->currentText()); |
102 | mail->setTo( toLine->text() ); | 118 | mail->setTo( toLine->text() ); |
103 | mail->setName(senderNameEdit->text()); | 119 | mail->setName(senderNameEdit->text()); |
104 | mail->setCC( ccLine->text() ); | 120 | mail->setCC( ccLine->text() ); |
105 | mail->setBCC( bccLine->text() ); | 121 | mail->setBCC( bccLine->text() ); |
106 | mail->setReply( replyLine->text() ); | 122 | mail->setReply( replyLine->text() ); |
107 | mail->setSubject( subjectLine->text() ); | 123 | mail->setSubject( subjectLine->text() ); |
108 | if (!m_replyid.isEmpty()) { | 124 | if (!m_replyid.isEmpty()) { |
109 | QStringList ids; | 125 | QStringList ids; |
110 | ids.append(m_replyid); | 126 | ids.append(m_replyid); |
111 | mail->setInreply(ids); | 127 | mail->setInreply(ids); |
112 | } | 128 | } |
113 | QString txt = message->text(); | 129 | QString txt = message->text(); |
114 | if ( !sigMultiLine->text().isEmpty() ) { | 130 | if ( !sigMultiLine->text().isEmpty() ) { |
115 | txt.append( "\n--\n" ); | 131 | txt.append( "\n--\n" ); |
116 | txt.append( sigMultiLine->text() ); | 132 | txt.append( sigMultiLine->text() ); |
117 | } | 133 | } |
118 | mail->setMessage( txt ); | 134 | mail->setMessage( txt ); |
119 | 135 | ||
120 | /* only use the default drafts folder name! */ | 136 | /* only use the default drafts folder name! */ |
121 | Storemail wrapper(AbstractMail::draftFolder()); | 137 | Storemail wrapper(AbstractMail::draftFolder()); |
122 | wrapper.storeMail(mail); | 138 | wrapper.storeMail(mail); |
123 | 139 | ||
124 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 140 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
125 | /* attachments we will ignore! */ | 141 | /* attachments we will ignore! */ |
126 | if ( it != 0 ) { | 142 | if ( it != 0 ) { |
127 | if ( warnAttach ) | 143 | if ( warnAttach ) |
128 | QMessageBox::warning(0,tr("Store message"), | 144 | QMessageBox::warning(0,tr("Store message"), |
129 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 145 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
130 | warnAttach = false; | 146 | warnAttach = false; |
131 | } | 147 | } |
132 | setStatus( tr("Mail saved as draft!") ); | 148 | setStatus( tr("Mail saved as draft!") ); |
133 | } | 149 | } |
134 | void ComposeMail::clearStatus() | 150 | void ComposeMail::clearStatus() |
135 | { | 151 | { |
136 | topLevelWidget()->setCaption( tr("Compose mail") ); | 152 | topLevelWidget()->setCaption( tr("Compose mail") ); |
137 | } | 153 | } |
138 | void ComposeMail::setStatus( QString status ) | 154 | void ComposeMail::setStatus( QString status ) |
139 | { | 155 | { |
140 | topLevelWidget()->setCaption( status ); | 156 | topLevelWidget()->setCaption( status ); |
141 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; | 157 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; |
142 | } | 158 | } |
143 | void ComposeMail::pickAddress( QLineEdit *line ) | 159 | void ComposeMail::pickAddress( ) |
144 | { | 160 | { |
161 | |||
162 | QLineEdit *line = mPickLineEdit; | ||
163 | if ( line == 0 ) | ||
164 | return; | ||
165 | #ifdef DESKTOP_VERSION | ||
145 | //qDebug(" ComposeMail::pickAddress "); | 166 | //qDebug(" ComposeMail::pickAddress "); |
146 | QString names ;//= AddressPicker::getNames(); | 167 | QString names ;//= AddressPicker::getNames(); |
147 | 168 | ||
148 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 169 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
149 | uint i=0; | 170 | uint i=0; |
150 | for (i=0; i < list.count(); i++) { | 171 | for (i=0; i < list.count(); i++) { |
151 | if ( !list[i].preferredEmail().isEmpty()) { | 172 | if ( !list[i].preferredEmail().isEmpty()) { |
152 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; | 173 | if ( ! names.isEmpty() ) |
153 | if ( i < list.count() -1 ) | ||
154 | names+= ","; | 174 | names+= ","; |
175 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; | ||
176 | |||
155 | } | 177 | } |
156 | } | 178 | } |
157 | 179 | ||
158 | 180 | ||
159 | if ( line->text().isEmpty() ) { | 181 | if ( line->text().isEmpty() ) { |
160 | line->setText( names ); | 182 | line->setText( names ); |
161 | } else if ( !names.isEmpty() ) { | 183 | } else if ( !names.isEmpty() ) { |
162 | line->setText( line->text() + ", " + names ); | 184 | line->setText( line->text() + ", " + names ); |
163 | } | 185 | } |
186 | #else | ||
187 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); | ||
188 | // the result should now arrive through method insertAttendees | ||
189 | #endif | ||
190 | } | ||
191 | //the map includes name/email pairs, that comes from Ka/Pi | ||
192 | void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | ||
193 | { | ||
194 | qDebug("ComposeMail::insertAttendees "); | ||
195 | raise(); | ||
196 | |||
197 | if ( mPickLineEdit == 0 ) { //whoami received | ||
198 | |||
199 | QString defmail = uidList[0]; | ||
200 | if ( emailList.count() == 0 ) | ||
201 | QMessageBox::information( 0, tr( "Hint" ), | ||
202 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | ||
203 | tr( "Ok" ) ); | ||
204 | if (defmail.length()!=0) { | ||
205 | fromBox->insertItem(defmail); | ||
206 | } | ||
207 | QStringList::ConstIterator sit = emailList.begin(); | ||
208 | int pref = 0; | ||
209 | for (;sit!=emailList.end();++sit) { | ||
210 | if ( (*sit)==defmail) | ||
211 | continue; | ||
212 | fromBox->insertItem((*sit)); | ||
213 | } | ||
214 | senderNameEdit->setText(nameList[0]); | ||
215 | return; | ||
216 | } | ||
217 | QString names ; | ||
218 | QLineEdit *line = mPickLineEdit; | ||
219 | if (uid == this->name()) | ||
220 | { | ||
221 | for ( int i = 0; i < nameList.count(); i++) | ||
222 | { | ||
223 | QString _name = nameList[i]; | ||
224 | QString _email = emailList[i]; | ||
225 | QString _uid = uidList[i]; | ||
226 | if ( ! _email.isEmpty() ) { | ||
227 | if ( ! names.isEmpty() ) | ||
228 | names+= ","; | ||
229 | names+= "\""+_name +"\"<" +_email +">"; | ||
230 | } | ||
231 | } | ||
232 | } | ||
233 | if ( line->text().isEmpty() ) { | ||
234 | line->setText( names ); | ||
235 | } else if ( !names.isEmpty() ) { | ||
236 | line->setText( line->text() + ", " + names ); | ||
237 | } | ||
164 | } | 238 | } |
165 | |||
166 | 239 | ||
167 | void ComposeMail::setTo( const QString & to ) | 240 | void ComposeMail::setTo( const QString & to ) |
168 | { | 241 | { |
169 | toLine->setText( to ); | 242 | toLine->setText( to ); |
170 | } | 243 | } |
171 | 244 | ||
172 | void ComposeMail::setSubject( const QString & subject ) | 245 | void ComposeMail::setSubject( const QString & subject ) |
173 | { | 246 | { |
174 | subjectLine->setText( subject ); | 247 | subjectLine->setText( subject ); |
175 | } | 248 | } |
176 | 249 | ||
177 | void ComposeMail::setInReplyTo( const QString & messageId ) | 250 | void ComposeMail::setInReplyTo( const QString & messageId ) |
178 | { | 251 | { |
179 | m_replyid = messageId; | 252 | m_replyid = messageId; |
180 | } | 253 | } |
181 | 254 | ||
182 | void ComposeMail::setMessage( const QString & text ) | 255 | void ComposeMail::setMessage( const QString & text ) |
183 | { | 256 | { |
184 | message->setText( text ); | 257 | message->setText( text ); |
185 | } | 258 | } |
186 | 259 | ||
187 | 260 | ||
188 | void ComposeMail::pickAddressTo() | 261 | void ComposeMail::pickAddressTo() |
189 | { | 262 | { |
190 | pickAddress( toLine ); | 263 | mPickLineEdit = toLine; |
264 | pickAddress( ); | ||
191 | } | 265 | } |
192 | 266 | ||
193 | void ComposeMail::pickAddressCC() | 267 | void ComposeMail::pickAddressCC() |
194 | { | 268 | { |
195 | pickAddress( ccLine ); | 269 | mPickLineEdit = ccLine; |
270 | pickAddress( ); | ||
196 | } | 271 | } |
197 | 272 | ||
198 | void ComposeMail::pickAddressBCC() | 273 | void ComposeMail::pickAddressBCC() |
199 | { | 274 | { |
200 | pickAddress( bccLine ); | 275 | mPickLineEdit = bccLine; |
276 | pickAddress( ); | ||
201 | } | 277 | } |
202 | 278 | ||
203 | void ComposeMail::pickAddressReply() | 279 | void ComposeMail::pickAddressReply() |
204 | { | 280 | { |
205 | pickAddress( replyLine ); | 281 | mPickLineEdit = replyLine; |
282 | pickAddress( ); | ||
206 | } | 283 | } |
207 | 284 | ||
208 | void ComposeMail::fillValues( int ) | 285 | void ComposeMail::fillValues( int ) |
209 | { | 286 | { |
210 | #if 0 | 287 | #if 0 |
211 | SMTPaccount *smtp = smtpAccounts.at( current ); | 288 | SMTPaccount *smtp = smtpAccounts.at( current ); |
212 | ccLine->clear(); | 289 | ccLine->clear(); |
213 | if ( smtp->getUseCC() ) { | 290 | if ( smtp->getUseCC() ) { |
214 | ccLine->setText( smtp->getCC() ); | 291 | ccLine->setText( smtp->getCC() ); |
215 | } | 292 | } |
216 | bccLine->clear(); | 293 | bccLine->clear(); |
217 | if ( smtp->getUseBCC() ) { | 294 | if ( smtp->getUseBCC() ) { |
218 | bccLine->setText( smtp->getBCC() ); | 295 | bccLine->setText( smtp->getBCC() ); |
219 | } | 296 | } |
220 | replyLine->clear(); | 297 | replyLine->clear(); |
221 | if ( smtp->getUseReply() ) { | 298 | if ( smtp->getUseReply() ) { |
222 | replyLine->setText( smtp->getReply() ); | 299 | replyLine->setText( smtp->getReply() ); |
223 | } | 300 | } |
224 | sigMultiLine->setText( smtp->getSignature() ); | 301 | sigMultiLine->setText( smtp->getSignature() ); |
225 | #endif | 302 | #endif |
226 | } | 303 | } |
227 | 304 | ||
228 | void ComposeMail::slotAdjustColumns() | 305 | void ComposeMail::slotAdjustColumns() |
229 | { | 306 | { |
230 | int currPage = tabWidget->currentPageIndex(); | 307 | int currPage = tabWidget->currentPageIndex(); |
231 | 308 | ||
232 | tabWidget->showPage( attachTab ); | 309 | tabWidget->showPage( attachTab ); |
233 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 310 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
234 | attList->setColumnWidth( 1, 80 ); | 311 | attList->setColumnWidth( 1, 80 ); |
235 | 312 | ||
236 | tabWidget->setCurrentPage( currPage ); | 313 | tabWidget->setCurrentPage( currPage ); |
237 | } | 314 | } |
238 | 315 | ||
239 | void ComposeMail::addAttachment() | 316 | void ComposeMail::addAttachment() |
240 | { | 317 | { |
241 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); | 318 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); |
242 | if ( !lnk.isEmpty() ) { | 319 | if ( !lnk.isEmpty() ) { |
243 | Attachment *att = new Attachment( lnk ); | 320 | Attachment *att = new Attachment( lnk ); |
244 | (void) new AttachViewItem( attList, att ); | 321 | (void) new AttachViewItem( attList, att ); |
245 | } | 322 | } |
246 | } | 323 | } |
247 | 324 | ||
248 | void ComposeMail::removeAttachment() | 325 | void ComposeMail::removeAttachment() |
249 | { | 326 | { |
250 | if ( !attList->currentItem() ) { | 327 | if ( !attList->currentItem() ) { |
251 | QMessageBox::information( this, tr( "Error" ), | 328 | QMessageBox::information( this, tr( "Error" ), |
252 | tr( "<p>Please select a File.</p>" ), | 329 | tr( "<p>Please select a File.</p>" ), |
253 | tr( "Ok" ) ); | 330 | tr( "Ok" ) ); |
254 | } else { | 331 | } else { |
255 | attList->takeItem( attList->currentItem() ); | 332 | attList->takeItem( attList->currentItem() ); |
256 | } | 333 | } |
257 | } | 334 | } |
258 | 335 | ||
259 | void ComposeMail::accept() | 336 | void ComposeMail::accept() |
260 | { | 337 | { |
261 | if ( smtpAccountBox->count() == 0 ) { | 338 | if ( smtpAccountBox->count() == 0 ) { |
262 | 339 | ||
263 | reject(); | 340 | reject(); |
264 | return; | 341 | return; |
265 | } | 342 | } |
266 | 343 | ||
267 | if (! checkBoxLater->isChecked() ) { | 344 | if (! checkBoxLater->isChecked() ) { |
268 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), | 345 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), |
269 | tr("Send this message?"), | 346 | tr("Send this message?"), |
270 | tr("Yes"), | 347 | tr("Yes"), |
271 | tr("Cancel")); | 348 | tr("Cancel")); |
272 | 349 | ||
273 | if (yesno == 1) { | 350 | if (yesno == 1) { |
274 | return; | 351 | return; |
275 | } | 352 | } |
276 | } | 353 | } |
277 | #if 0 | 354 | #if 0 |
278 | odebug << "Sending Mail with " | 355 | odebug << "Sending Mail with " |
279 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; | 356 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; |
280 | #endif | 357 | #endif |
281 | Opie::Core::OSmartPointer<Mail> mail=new Mail; | 358 | Opie::Core::OSmartPointer<Mail> mail=new Mail; |
282 | 359 | ||
283 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 360 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
284 | mail->setMail(fromBox->currentText()); | 361 | mail->setMail(fromBox->currentText()); |
285 | 362 | ||
286 | if ( !toLine->text().isEmpty() ) { | 363 | if ( !toLine->text().isEmpty() ) { |
287 | mail->setTo( toLine->text() ); | 364 | mail->setTo( toLine->text() ); |
288 | } else { | 365 | } else { |
289 | QMessageBox::warning(0,tr("Sending mail"), | 366 | QMessageBox::warning(0,tr("Sending mail"), |
290 | tr("No Receiver spezified" ) ); | 367 | tr("No Receiver spezified" ) ); |
291 | return; | 368 | return; |
292 | } | 369 | } |
293 | 370 | ||
294 | mail->setName(senderNameEdit->text()); | 371 | mail->setName(senderNameEdit->text()); |
295 | mail->setCC( ccLine->text() ); | 372 | mail->setCC( ccLine->text() ); |
296 | mail->setBCC( bccLine->text() ); | 373 | mail->setBCC( bccLine->text() ); |
297 | mail->setReply( replyLine->text() ); | 374 | mail->setReply( replyLine->text() ); |
298 | mail->setSubject( subjectLine->text() ); | 375 | mail->setSubject( subjectLine->text() ); |
299 | if (!m_replyid.isEmpty()) { | 376 | if (!m_replyid.isEmpty()) { |
300 | QStringList ids; | 377 | QStringList ids; |
301 | ids.append(m_replyid); | 378 | ids.append(m_replyid); |
302 | mail->setInreply(ids); | 379 | mail->setInreply(ids); |
303 | } | 380 | } |
304 | QString txt = message->text(); | 381 | QString txt = message->text(); |
305 | if ( !sigMultiLine->text().isEmpty() ) { | 382 | if ( !sigMultiLine->text().isEmpty() ) { |
306 | txt.append( "\n--\n" ); | 383 | txt.append( "\n--\n" ); |
307 | txt.append( sigMultiLine->text() ); | 384 | txt.append( sigMultiLine->text() ); |
308 | } | 385 | } |
309 | mail->setMessage( txt ); | 386 | mail->setMessage( txt ); |
310 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 387 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
311 | while ( it != 0 ) { | 388 | while ( it != 0 ) { |
312 | mail->addAttachment( it->getAttachment() ); | 389 | mail->addAttachment( it->getAttachment() ); |
313 | it = (AttachViewItem *) it->nextSibling(); | 390 | it = (AttachViewItem *) it->nextSibling(); |
314 | } | 391 | } |
315 | 392 | ||
316 | SMTPwrapper wrapper( smtp ); | 393 | SMTPwrapper wrapper( smtp ); |
317 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) | 394 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) |
318 | setStatus( tr ("Mail sent")); | 395 | setStatus( tr ("Mail sent")); |
319 | else { | 396 | else { |
320 | setStatus( tr ("Error: Something went wrong. Nothing sent")); | 397 | setStatus( tr ("Error: Something went wrong. Nothing sent")); |
321 | return; | 398 | return; |
322 | } | 399 | } |
323 | 400 | ||
324 | 401 | ||
325 | QDialog::accept(); | 402 | QDialog::accept(); |
326 | } | 403 | } |
327 | 404 | ||
328 | void ComposeMail::reject() | 405 | void ComposeMail::reject() |
329 | { | 406 | { |
330 | //qDebug("ComposeMail::reject() "); | 407 | //qDebug("ComposeMail::reject() "); |
331 | int yesno = QMessageBox::warning(0,tr("Store message?"), | 408 | int yesno = QMessageBox::warning(0,tr("Store message?"), |
332 | tr("Store message into drafts?\n"), | 409 | tr("Store message into drafts?\n"), |
333 | tr("Yes"), | 410 | tr("Yes"), |
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h index 876b597..657f665 100644 --- a/kmicromail/composemail.h +++ b/kmicromail/composemail.h | |||
@@ -1,86 +1,90 @@ | |||
1 | #ifndef COMPOSEMAIL_H | 1 | #ifndef COMPOSEMAIL_H |
2 | #define COMPOSEMAIL_H | 2 | #define COMPOSEMAIL_H |
3 | 3 | ||
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qlistview.h> | 5 | #include <qlistview.h> |
6 | 6 | ||
7 | #include "composemailui.h" | 7 | #include "composemailui.h" |
8 | //#include "addresspickerui.h" | 8 | //#include "addresspickerui.h" |
9 | #include <libmailwrapper/settings.h> | 9 | #include <libmailwrapper/settings.h> |
10 | #include <libmailwrapper/mailwrapper.h> | 10 | #include <libmailwrapper/mailwrapper.h> |
11 | 11 | ||
12 | class RecMail; | 12 | class RecMail; |
13 | 13 | ||
14 | #include <opie2/osmartpointer.h> | 14 | #include <opie2/osmartpointer.h> |
15 | #if 0 | 15 | #if 0 |
16 | class AddressPicker : public AddressPickerUI | 16 | class AddressPicker : public AddressPickerUI |
17 | { | 17 | { |
18 | //Q_OBJECT | 18 | //Q_OBJECT |
19 | 19 | ||
20 | public: | 20 | public: |
21 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); | 21 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); |
22 | static QString getNames(); | 22 | static QString getNames(); |
23 | 23 | ||
24 | protected: | 24 | protected: |
25 | QString selectedNames; | 25 | QString selectedNames; |
26 | void accept(); | 26 | void accept(); |
27 | 27 | ||
28 | }; | 28 | }; |
29 | #endif | 29 | #endif |
30 | class RecMail; | 30 | class RecMail; |
31 | 31 | ||
32 | class ComposeMail : public ComposeMailUI | 32 | class ComposeMail : public ComposeMailUI |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | 35 | ||
36 | public: | 36 | public: |
37 | |||
37 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); | 38 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); |
38 | virtual ~ComposeMail(); | 39 | virtual ~ComposeMail(); |
39 | 40 | ||
40 | void reEditMail(const Opie::Core::OSmartPointer<RecMail>¤t); | 41 | void reEditMail(const Opie::Core::OSmartPointer<RecMail>¤t); |
41 | 42 | ||
42 | public slots: | 43 | public slots: |
43 | void slotAdjustColumns(); | 44 | void slotAdjustColumns(); |
44 | 45 | ||
45 | void setTo( const QString & to ); | 46 | void setTo( const QString & to ); |
46 | void setSubject( const QString & subject ); | 47 | void setSubject( const QString & subject ); |
47 | void setInReplyTo( const QString & messageId ); | 48 | void setInReplyTo( const QString & messageId ); |
48 | void setMessage( const QString & text ); | 49 | void setMessage( const QString & text ); |
50 | void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); | ||
51 | |||
49 | 52 | ||
50 | protected slots: | 53 | protected slots: |
51 | void accept(); | 54 | void accept(); |
52 | void reject(); | 55 | void reject(); |
53 | 56 | ||
54 | private slots: | 57 | private slots: |
55 | void fillValues( int current ); | 58 | void fillValues( int current ); |
56 | void pickAddress( QLineEdit *line ); | 59 | void pickAddress(); |
57 | void pickAddressTo(); | 60 | void pickAddressTo(); |
58 | void pickAddressCC(); | 61 | void pickAddressCC(); |
59 | void pickAddressBCC(); | 62 | void pickAddressBCC(); |
60 | void pickAddressReply(); | 63 | void pickAddressReply(); |
61 | void saveAsDraft(); | 64 | void saveAsDraft(); |
62 | void addAttachment(); | 65 | void addAttachment(); |
63 | void removeAttachment(); | 66 | void removeAttachment(); |
64 | void clearStatus(); | 67 | void clearStatus(); |
65 | void setStatus( QString ); | 68 | void setStatus( QString ); |
66 | 69 | ||
67 | protected: | 70 | protected: |
71 | QLineEdit* mPickLineEdit; | ||
68 | Opie::Core::OSmartPointer<Mail> mMail; | 72 | Opie::Core::OSmartPointer<Mail> mMail; |
69 | Settings *settings; | 73 | Settings *settings; |
70 | QList<SMTPaccount> smtpAccounts; | 74 | QList<SMTPaccount> smtpAccounts; |
71 | QString m_replyid; | 75 | QString m_replyid; |
72 | bool warnAttach; | 76 | bool warnAttach; |
73 | }; | 77 | }; |
74 | 78 | ||
75 | class AttachViewItem : public QListViewItem | 79 | class AttachViewItem : public QListViewItem |
76 | { | 80 | { |
77 | public: | 81 | public: |
78 | AttachViewItem( QListView *parent, Attachment *att ); | 82 | AttachViewItem( QListView *parent, Attachment *att ); |
79 | Attachment *getAttachment() { return attachment; } | 83 | Attachment *getAttachment() { return attachment; } |
80 | 84 | ||
81 | private: | 85 | private: |
82 | Attachment *attachment; | 86 | Attachment *attachment; |
83 | 87 | ||
84 | }; | 88 | }; |
85 | 89 | ||
86 | #endif | 90 | #endif |
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp index 22f1200..a3e1b86 100644 --- a/kmicromail/main.cpp +++ b/kmicromail/main.cpp | |||
@@ -1,58 +1,61 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | |||
3 | #ifndef DESKTOP_VERSION | 4 | #ifndef DESKTOP_VERSION |
4 | #include <qpe/qpeapplication.h> | 5 | #include <qpe/qpeapplication.h> |
6 | #include <libkdepim/externalapphandler.h> | ||
5 | #include <stdlib.h> | 7 | #include <stdlib.h> |
6 | #else | 8 | #else |
7 | #include <qapplication.h> | 9 | #include <qapplication.h> |
8 | #include <qstring.h> | 10 | #include <qstring.h> |
9 | #include <qwindowsstyle.h> | 11 | #include <qwindowsstyle.h> |
10 | #include <qplatinumstyle.h> | 12 | #include <qplatinumstyle.h> |
11 | #include <qsgistyle.h> | 13 | #include <qsgistyle.h> |
12 | #endif | 14 | #endif |
13 | #include "opiemail.h" | 15 | #include "opiemail.h" |
14 | #include <qdir.h> | 16 | #include <qdir.h> |
15 | #include <kstandarddirs.h> | 17 | #include <kstandarddirs.h> |
16 | #include <kglobal.h> | 18 | #include <kglobal.h> |
17 | #include <stdio.h> | 19 | #include <stdio.h> |
18 | #include "mainwindow.h" | 20 | #include "mainwindow.h" |
19 | 21 | ||
20 | using namespace Opie::Core; | 22 | using namespace Opie::Core; |
21 | int main( int argc, char **argv ) { | 23 | int main( int argc, char **argv ) { |
22 | 24 | ||
23 | #ifndef DESKTOP_VERSION | 25 | #ifndef DESKTOP_VERSION |
24 | QPEApplication a( argc, argv ); | 26 | QPEApplication a( argc, argv ); |
25 | a.setKeepRunning (); | 27 | a.setKeepRunning (); |
26 | #else | 28 | #else |
27 | QApplication a( argc, argv ); | 29 | QApplication a( argc, argv ); |
28 | QApplication::setStyle( new QPlatinumStyle ()); | 30 | QApplication::setStyle( new QPlatinumStyle ()); |
29 | #endif | 31 | #endif |
30 | 32 | ||
31 | KGlobal::setAppName( "kmicromail" ); | 33 | KGlobal::setAppName( "kmicromail" ); |
32 | QString fileName ; | 34 | QString fileName ; |
33 | #ifndef DESKTOP_VERSION | 35 | #ifndef DESKTOP_VERSION |
34 | fileName = getenv("QPEDIR"); | 36 | fileName = getenv("QPEDIR"); |
35 | if ( QApplication::desktop()->width() > 320 ) | 37 | if ( QApplication::desktop()->width() > 320 ) |
36 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/"); | 38 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/"); |
37 | else | 39 | else |
38 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/"); | 40 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/"); |
39 | #else | 41 | #else |
40 | fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/"; | 42 | fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/"; |
41 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 43 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
42 | #endif | 44 | #endif |
43 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail"))); | 45 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail"))); |
44 | OpieMail mw; | 46 | OpieMail mw; |
45 | #ifndef DESKTOP_VERSION | 47 | #ifndef DESKTOP_VERSION |
46 | //qDebug("CONNECT "); | 48 | //qDebug("CONNECT "); |
47 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); | 49 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); |
50 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | ||
48 | a.showMainWidget(&mw ); | 51 | a.showMainWidget(&mw ); |
49 | #else | 52 | #else |
50 | a.setMainWidget(&mw ); | 53 | a.setMainWidget(&mw ); |
51 | mw.show(); | 54 | mw.show(); |
52 | //m.resize( 800, 600 ); | 55 | //m.resize( 800, 600 ); |
53 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 56 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
54 | #endif | 57 | #endif |
55 | int rv = a.exec(); | 58 | int rv = a.exec(); |
56 | return rv; | 59 | return rv; |
57 | 60 | ||
58 | } | 61 | } |
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 704a9ab..6df95c6 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -1,155 +1,155 @@ | |||
1 | 1 | ||
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qvbox.h> | 4 | #include <qvbox.h> |
5 | #include <qheader.h> | 5 | #include <qheader.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qlayout.h> | 7 | #include <qlayout.h> |
8 | #include <kdialog.h> | 8 | #include <kdialog.h> |
9 | #include <kiconloader.h> | 9 | #include <kiconloader.h> |
10 | #include <kapplication.h> | 10 | #include <kapplication.h> |
11 | 11 | ||
12 | #ifndef DESKTOP_VERSION | 12 | #ifndef DESKTOP_VERSION |
13 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
14 | #endif | 14 | #endif |
15 | #include "defines.h" | 15 | #include "defines.h" |
16 | #include "mainwindow.h" | 16 | #include "mainwindow.h" |
17 | #include <KDGanttMinimizeSplitter.h> | 17 | #include <KDGanttMinimizeSplitter.h> |
18 | 18 | ||
19 | 19 | ||
20 | #include <kabc/stdaddressbook.h> | 20 | #include <kabc/stdaddressbook.h> |
21 | 21 | ||
22 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 22 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
23 | : QMainWindow( parent, name ) //, flags ) | 23 | : QMainWindow( parent, name ) //, flags ) |
24 | { | 24 | { |
25 | setCaption( tr( "KOpieMail/Pi" ) ); | 25 | setCaption( tr( "KOpieMail/Pi" ) ); |
26 | setToolBarsMovable( false ); | 26 | setToolBarsMovable( false ); |
27 | KABC::StdAddressBook::self(); | 27 | //KABC::StdAddressBook::self(); |
28 | toolBar = new QToolBar( this ); | 28 | toolBar = new QToolBar( this ); |
29 | menuBar = new QMenuBar( toolBar ); | 29 | menuBar = new QMenuBar( toolBar ); |
30 | mailMenu = new QPopupMenu( menuBar ); | 30 | mailMenu = new QPopupMenu( menuBar ); |
31 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 31 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
32 | settingsMenu = new QPopupMenu( menuBar ); | 32 | settingsMenu = new QPopupMenu( menuBar ); |
33 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 33 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
34 | 34 | ||
35 | addToolBar( toolBar ); | 35 | addToolBar( toolBar ); |
36 | toolBar->setHorizontalStretchable( true ); | 36 | toolBar->setHorizontalStretchable( true ); |
37 | 37 | ||
38 | 38 | ||
39 | 39 | ||
40 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), | 40 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), |
41 | 0, 0, this ); | 41 | 0, 0, this ); |
42 | composeMail->addTo( toolBar ); | 42 | composeMail->addTo( toolBar ); |
43 | composeMail->addTo( mailMenu ); | 43 | composeMail->addTo( mailMenu ); |
44 | 44 | ||
45 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , | 45 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , |
46 | 0, 0, this ); | 46 | 0, 0, this ); |
47 | sendQueued->addTo( toolBar ); | 47 | sendQueued->addTo( toolBar ); |
48 | sendQueued->addTo( mailMenu ); | 48 | sendQueued->addTo( mailMenu ); |
49 | 49 | ||
50 | /* | 50 | /* |
51 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 51 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
52 | 0, 0, this ); | 52 | 0, 0, this ); |
53 | syncFolders->addTo( toolBar ); | 53 | syncFolders->addTo( toolBar ); |
54 | syncFolders->addTo( mailMenu ); | 54 | syncFolders->addTo( mailMenu ); |
55 | */ | 55 | */ |
56 | 56 | ||
57 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , | 57 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , |
58 | 0, 0, this, 0, true ); | 58 | 0, 0, this, 0, true ); |
59 | showFolders->addTo( toolBar ); | 59 | showFolders->addTo( toolBar ); |
60 | showFolders->addTo( mailMenu ); | 60 | showFolders->addTo( mailMenu ); |
61 | showFolders->setOn( true ); | 61 | showFolders->setOn( true ); |
62 | connect(showFolders, SIGNAL( toggled(bool) ), | 62 | connect(showFolders, SIGNAL( toggled(bool) ), |
63 | SLOT( slotShowFolders(bool) ) ); | 63 | SLOT( slotShowFolders(bool) ) ); |
64 | 64 | ||
65 | /* | 65 | /* |
66 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), | 66 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), |
67 | 0, 0, this ); | 67 | 0, 0, this ); |
68 | searchMails->addTo( toolBar ); | 68 | searchMails->addTo( toolBar ); |
69 | searchMails->addTo( mailMenu ); | 69 | searchMails->addTo( mailMenu ); |
70 | */ | 70 | */ |
71 | 71 | ||
72 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); | 72 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); |
73 | deleteMails->addTo( toolBar ); | 73 | deleteMails->addTo( toolBar ); |
74 | deleteMails->addTo( mailMenu ); | 74 | deleteMails->addTo( mailMenu ); |
75 | connect( deleteMails, SIGNAL( activated() ), | 75 | connect( deleteMails, SIGNAL( activated() ), |
76 | SLOT( slotDeleteMail() ) ); | 76 | SLOT( slotDeleteMail() ) ); |
77 | 77 | ||
78 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , | 78 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , |
79 | 0, 0, this ); | 79 | 0, 0, this ); |
80 | editSettings->addTo( settingsMenu ); | 80 | editSettings->addTo( settingsMenu ); |
81 | connect( editSettings, SIGNAL( activated() ), | 81 | connect( editSettings, SIGNAL( activated() ), |
82 | SLOT( slotEditSettings() ) ); | 82 | SLOT( slotEditSettings() ) ); |
83 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , | 83 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , |
84 | 0, 0, this ); | 84 | 0, 0, this ); |
85 | editAccounts->addTo( settingsMenu ); | 85 | editAccounts->addTo( settingsMenu ); |
86 | 86 | ||
87 | //setCentralWidget( view ); | 87 | //setCentralWidget( view ); |
88 | 88 | ||
89 | QVBox* wrapperBox = new QVBox( this ); | 89 | QVBox* wrapperBox = new QVBox( this ); |
90 | setCentralWidget( wrapperBox ); | 90 | setCentralWidget( wrapperBox ); |
91 | 91 | ||
92 | // QWidget *view = new QWidget( wrapperBox ); | 92 | // QWidget *view = new QWidget( wrapperBox ); |
93 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); | 93 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); |
94 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); | 94 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); |
95 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); | 95 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); |
96 | 96 | ||
97 | folderView = new AccountView( split ); | 97 | folderView = new AccountView( split ); |
98 | folderView->header()->hide(); | 98 | folderView->header()->hide(); |
99 | folderView->setRootIsDecorated( false ); | 99 | folderView->setRootIsDecorated( false ); |
100 | folderView->addColumn( tr( "Mailbox" ) ); | 100 | folderView->addColumn( tr( "Mailbox" ) ); |
101 | 101 | ||
102 | //layout->addWidget( folderView ); | 102 | //layout->addWidget( folderView ); |
103 | 103 | ||
104 | mailView = new QListView( split ); | 104 | mailView = new QListView( split ); |
105 | mailView->addColumn( tr( " " ) ); | 105 | mailView->addColumn( tr( " " ) ); |
106 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 106 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
107 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 107 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
108 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 108 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
109 | mailView->addColumn( tr( "Date" ),QListView::Manual); | 109 | mailView->addColumn( tr( "Date" ),QListView::Manual); |
110 | mailView->setAllColumnsShowFocus(true); | 110 | mailView->setAllColumnsShowFocus(true); |
111 | //mailView->setSorting(-1); | 111 | //mailView->setSorting(-1); |
112 | mailView->setRootIsDecorated( false ); | 112 | mailView->setRootIsDecorated( false ); |
113 | statusWidget = new StatusWidget( wrapperBox ); | 113 | statusWidget = new StatusWidget( wrapperBox ); |
114 | statusWidget->hide(); | 114 | statusWidget->hide(); |
115 | 115 | ||
116 | //layout->addWidget( mailView ); | 116 | //layout->addWidget( mailView ); |
117 | //layout->setStretchFactor( folderView, 1 ); | 117 | //layout->setStretchFactor( folderView, 1 ); |
118 | //layout->setStretchFactor( mailView, 2 ); | 118 | //layout->setStretchFactor( mailView, 2 ); |
119 | 119 | ||
120 | slotAdjustLayout(); | 120 | slotAdjustLayout(); |
121 | #ifndef DESKTOP_VERSION | 121 | #ifndef DESKTOP_VERSION |
122 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 122 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
123 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 123 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
124 | #endif | 124 | #endif |
125 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, | 125 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, |
126 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 126 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
127 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, | 127 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, |
128 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 128 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
129 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 129 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
130 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); | 130 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); |
131 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), | 131 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), |
132 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); | 132 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); |
133 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 133 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
134 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 134 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
135 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 135 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
136 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 136 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
137 | //mailView->setMultiSelection ( true ); | 137 | //mailView->setMultiSelection ( true ); |
138 | mailView->setSelectionMode( QListView::Extended ); | 138 | mailView->setSelectionMode( QListView::Extended ); |
139 | QValueList<int> list; | 139 | QValueList<int> list; |
140 | int fw = 100; | 140 | int fw = 100; |
141 | if ( QApplication::desktop()->width() > 320 ) | 141 | if ( QApplication::desktop()->width() > 320 ) |
142 | fw = 50; | 142 | fw = 50; |
143 | list.append( fw ); | 143 | list.append( fw ); |
144 | list.append( 100 ); | 144 | list.append( 100 ); |
145 | split->setSizes( list ); | 145 | split->setSizes( list ); |
146 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 146 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
147 | mailView->setShowSortIndicator ( true ); | 147 | mailView->setShowSortIndicator ( true ); |
148 | QLabel *spacer = new QLabel( toolBar ); | 148 | QLabel *spacer = new QLabel( toolBar ); |
149 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 149 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
150 | toolBar->setStretchableWidget( spacer ); | 150 | toolBar->setStretchableWidget( spacer ); |
151 | 151 | ||
152 | QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); | 152 | QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); |
153 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 153 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |
154 | closeMail->addTo(toolBar); | 154 | closeMail->addTo(toolBar); |
155 | closeMail->addTo(mailMenu); | 155 | closeMail->addTo(mailMenu); |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 251f15a..3e560c5 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,234 +1,235 @@ | |||
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 | 14 | ||
15 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
16 | #include <libmailwrapper/smtpwrapper.h> | 16 | #include <libmailwrapper/smtpwrapper.h> |
17 | #include <libmailwrapper/mailtypes.h> | 17 | #include <libmailwrapper/mailtypes.h> |
18 | #include <libmailwrapper/abstractmail.h> | 18 | #include <libmailwrapper/abstractmail.h> |
19 | /* OPIE */ | 19 | /* OPIE */ |
20 | //#include <qpe/resource.h> | 20 | //#include <qpe/resource.h> |
21 | //#include <qpe/qpeapplication.h> | 21 | //#include <qpe/qpeapplication.h> |
22 | 22 | ||
23 | /* QT */ | 23 | /* QT */ |
24 | 24 | ||
25 | using namespace Opie::Core; | 25 | using namespace Opie::Core; |
26 | 26 | ||
27 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) | 27 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) |
28 | : MainWindow( parent, name) //, WStyle_ContextHelp ) | 28 | : MainWindow( parent, name) //, WStyle_ContextHelp ) |
29 | { | 29 | { |
30 | settings = new Settings(); | 30 | settings = new Settings(); |
31 | 31 | ||
32 | folderView->populate( settings->getAccounts() ); | 32 | folderView->populate( settings->getAccounts() ); |
33 | 33 | ||
34 | } | 34 | } |
35 | 35 | ||
36 | OpieMail::~OpieMail() | 36 | OpieMail::~OpieMail() |
37 | { | 37 | { |
38 | if (settings) delete settings; | 38 | if (settings) delete settings; |
39 | } | 39 | } |
40 | 40 | ||
41 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 41 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
42 | { | 42 | { |
43 | 43 | ||
44 | } | 44 | } |
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 46 | void OpieMail::message(const QCString &msg, const QByteArray &data) |
47 | { | 47 | { |
48 | // copied from old mail2 | 48 | // copied from old mail2 |
49 | static int ii = 0; | 49 | static int ii = 0; |
50 | 50 | ||
51 | // block second call | 51 | // block second call |
52 | if ( ii < 2 ) { | 52 | if ( ii < 2 ) { |
53 | ++ii; | 53 | ++ii; |
54 | if ( ii > 1 ) { | 54 | if ( ii > 1 ) { |
55 | qDebug("qcop call blocked "); | 55 | qDebug("qcop call blocked "); |
56 | return; | 56 | return; |
57 | } | 57 | } |
58 | } | 58 | } |
59 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 59 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
60 | if (msg == "writeMail(QString,QString)") | 60 | if (msg == "writeMail(QString,QString)") |
61 | { | 61 | { |
62 | QDataStream stream(data,IO_ReadOnly); | 62 | QDataStream stream(data,IO_ReadOnly); |
63 | QString name, email; | 63 | QString name, email; |
64 | stream >> name >> email; | 64 | stream >> name >> email; |
65 | // removing the whitespaces at beginning and end is needed! | 65 | // removing the whitespaces at beginning and end is needed! |
66 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); | 66 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); |
67 | } | 67 | } |
68 | else if (msg == "newMail()") | 68 | else if (msg == "newMail()") |
69 | { | 69 | { |
70 | slotComposeMail(); | 70 | slotComposeMail(); |
71 | } | 71 | } |
72 | else if (msg == "newMail(QString)") | 72 | else if (msg == "newMail(QString)") |
73 | { | 73 | { |
74 | QDataStream stream(data,IO_ReadOnly); | 74 | QDataStream stream(data,IO_ReadOnly); |
75 | QString nameemail; | 75 | QString nameemail; |
76 | stream >> nameemail; | 76 | stream >> nameemail; |
77 | // the format is | 77 | // the format is |
78 | // NAME <EMAIL>:SUBJECT | 78 | // NAME <EMAIL>:SUBJECT |
79 | //qDebug("message %s ", nameemail.latin1()); | 79 | //qDebug("message %s ", nameemail.latin1()); |
80 | 80 | ||
81 | slotwriteMail2( nameemail ); | 81 | slotwriteMail2( nameemail ); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | void OpieMail::slotwriteMail2(const QString& namemail ) | 84 | void OpieMail::slotwriteMail2(const QString& namemail ) |
85 | { | 85 | { |
86 | // qDebug("OpieMail::slotwriteMail2 "); | 86 | // qDebug("OpieMail::slotwriteMail2 "); |
87 | qApp->processEvents(); | 87 | qApp->processEvents(); |
88 | ComposeMail compose( settings, this, 0, true ); | 88 | ComposeMail compose( settings, this, 0, true ); |
89 | if ( !namemail.isEmpty() ) { | 89 | if ( !namemail.isEmpty() ) { |
90 | QString to = namemail; | 90 | QString to = namemail; |
91 | if ( namemail.find( " <") > 1 ) { | 91 | if ( namemail.find( " <") > 1 ) { |
92 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 92 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
93 | } else | 93 | } else |
94 | if ( namemail.find( "<") > 1 ) { | 94 | if ( namemail.find( "<") > 1 ) { |
95 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 95 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
96 | } | 96 | } |
97 | int sub = to.find( ">:"); | 97 | int sub = to.find( ">:"); |
98 | if ( sub > 0 ) { | 98 | if ( sub > 0 ) { |
99 | compose.setTo( to.left(sub+1) ); | 99 | compose.setTo( to.left(sub+1) ); |
100 | compose.setSubject( to.mid(sub+2) ); | 100 | compose.setSubject( to.mid(sub+2) ); |
101 | } else | 101 | } else |
102 | compose.setTo( to ); | 102 | compose.setTo( to ); |
103 | } | 103 | } |
104 | compose.slotAdjustColumns(); | 104 | compose.slotAdjustColumns(); |
105 | compose.showMaximized(); | 105 | compose.showMaximized(); |
106 | compose.exec(); | 106 | compose.exec(); |
107 | raise(); | ||
107 | //qDebug("retttich "); | 108 | //qDebug("retttich "); |
108 | } | 109 | } |
109 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 110 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
110 | { | 111 | { |
111 | // qDebug("OpieMail::slotwriteMail "); | 112 | // qDebug("OpieMail::slotwriteMail "); |
112 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 113 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
113 | if (!email.isEmpty()) | 114 | if (!email.isEmpty()) |
114 | { | 115 | { |
115 | if (!name.isEmpty()) | 116 | if (!name.isEmpty()) |
116 | { | 117 | { |
117 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 118 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
118 | } | 119 | } |
119 | else | 120 | else |
120 | { | 121 | { |
121 | compose.setTo(email); | 122 | compose.setTo(email); |
122 | } | 123 | } |
123 | } | 124 | } |
124 | compose.slotAdjustColumns(); | 125 | compose.slotAdjustColumns(); |
125 | compose.showMaximized(); | 126 | compose.showMaximized(); |
126 | compose.exec(); | 127 | compose.exec(); |
127 | } | 128 | } |
128 | 129 | ||
129 | void OpieMail::slotComposeMail() | 130 | void OpieMail::slotComposeMail() |
130 | { | 131 | { |
131 | slotwriteMail2( QString () ); | 132 | slotwriteMail2( QString () ); |
132 | //slotwriteMail(0l,0l); | 133 | //slotwriteMail(0l,0l); |
133 | } | 134 | } |
134 | 135 | ||
135 | void OpieMail::slotSendQueued() | 136 | void OpieMail::slotSendQueued() |
136 | { | 137 | { |
137 | SMTPaccount *smtp = 0; | 138 | SMTPaccount *smtp = 0; |
138 | 139 | ||
139 | QList<Account> list = settings->getAccounts(); | 140 | QList<Account> list = settings->getAccounts(); |
140 | QList<SMTPaccount> smtpList; | 141 | QList<SMTPaccount> smtpList; |
141 | smtpList.setAutoDelete(false); | 142 | smtpList.setAutoDelete(false); |
142 | Account *it; | 143 | Account *it; |
143 | for ( it = list.first(); it; it = list.next() ) | 144 | for ( it = list.first(); it; it = list.next() ) |
144 | { | 145 | { |
145 | if ( it->getType() == MAILLIB::A_SMTP ) | 146 | if ( it->getType() == MAILLIB::A_SMTP ) |
146 | { | 147 | { |
147 | smtp = static_cast<SMTPaccount *>(it); | 148 | smtp = static_cast<SMTPaccount *>(it); |
148 | smtpList.append(smtp); | 149 | smtpList.append(smtp); |
149 | } | 150 | } |
150 | } | 151 | } |
151 | if (smtpList.count()==0) | 152 | if (smtpList.count()==0) |
152 | { | 153 | { |
153 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); | 154 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); |
154 | return; | 155 | return; |
155 | } | 156 | } |
156 | if (smtpList.count()==1) | 157 | if (smtpList.count()==1) |
157 | { | 158 | { |
158 | smtp = smtpList.at(0); | 159 | smtp = smtpList.at(0); |
159 | } | 160 | } |
160 | else | 161 | else |
161 | { | 162 | { |
162 | smtp = 0; | 163 | smtp = 0; |
163 | selectsmtp selsmtp; | 164 | selectsmtp selsmtp; |
164 | selsmtp.setSelectionlist(&smtpList); | 165 | selsmtp.setSelectionlist(&smtpList); |
165 | selsmtp.showMaximized(); | 166 | selsmtp.showMaximized(); |
166 | if ( selsmtp.exec() == QDialog::Accepted ) | 167 | if ( selsmtp.exec() == QDialog::Accepted ) |
167 | { | 168 | { |
168 | smtp = selsmtp.selected_smtp(); | 169 | smtp = selsmtp.selected_smtp(); |
169 | } | 170 | } |
170 | } | 171 | } |
171 | if (smtp) | 172 | if (smtp) |
172 | { | 173 | { |
173 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 174 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
174 | if ( wrap->flushOutbox() ) | 175 | if ( wrap->flushOutbox() ) |
175 | { | 176 | { |
176 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 177 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
177 | } | 178 | } |
178 | delete wrap; | 179 | delete wrap; |
179 | } | 180 | } |
180 | } | 181 | } |
181 | 182 | ||
182 | void OpieMail::slotSearchMails() | 183 | void OpieMail::slotSearchMails() |
183 | { | 184 | { |
184 | qDebug("OpieMail::slotSearchMails():not implemented "); | 185 | qDebug("OpieMail::slotSearchMails():not implemented "); |
185 | } | 186 | } |
186 | 187 | ||
187 | void OpieMail::slotEditSettings() | 188 | void OpieMail::slotEditSettings() |
188 | { | 189 | { |
189 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 190 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
190 | settingsDialog.showMaximized(); | 191 | settingsDialog.showMaximized(); |
191 | settingsDialog.exec(); | 192 | settingsDialog.exec(); |
192 | } | 193 | } |
193 | 194 | ||
194 | void OpieMail::slotEditAccounts() | 195 | void OpieMail::slotEditAccounts() |
195 | { | 196 | { |
196 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 197 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); |
197 | eaDialog.slotAdjustColumns(); | 198 | eaDialog.slotAdjustColumns(); |
198 | eaDialog.showMaximized(); | 199 | eaDialog.showMaximized(); |
199 | eaDialog.exec(); | 200 | eaDialog.exec(); |
200 | if ( settings ) delete settings; | 201 | if ( settings ) delete settings; |
201 | settings = new Settings(); | 202 | settings = new Settings(); |
202 | 203 | ||
203 | folderView->populate( settings->getAccounts() ); | 204 | folderView->populate( settings->getAccounts() ); |
204 | } | 205 | } |
205 | 206 | ||
206 | void OpieMail::displayMail() | 207 | void OpieMail::displayMail() |
207 | { | 208 | { |
208 | QListViewItem*item = mailView->currentItem(); | 209 | QListViewItem*item = mailView->currentItem(); |
209 | if (!item) return; | 210 | if (!item) return; |
210 | RecMailP mail = ((MailListViewItem*)item)->data(); | 211 | RecMailP mail = ((MailListViewItem*)item)->data(); |
211 | RecBodyP body = folderView->fetchBody(mail); | 212 | RecBodyP body = folderView->fetchBody(mail); |
212 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); | 213 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); |
213 | readMail.setBody( body ); | 214 | readMail.setBody( body ); |
214 | readMail.setMail( mail ); | 215 | readMail.setMail( mail ); |
215 | readMail.showMaximized(); | 216 | readMail.showMaximized(); |
216 | readMail.exec(); | 217 | readMail.exec(); |
217 | 218 | ||
218 | if ( readMail.deleted ) | 219 | if ( readMail.deleted ) |
219 | { | 220 | { |
220 | folderView->refreshCurrent(); | 221 | folderView->refreshCurrent(); |
221 | } | 222 | } |
222 | else | 223 | else |
223 | { | 224 | { |
224 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 225 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
225 | } | 226 | } |
226 | } | 227 | } |
227 | 228 | ||
228 | void OpieMail::slotDeleteMail() | 229 | void OpieMail::slotDeleteMail() |
229 | { | 230 | { |
230 | if (!mailView->currentItem()) return; | 231 | if (!mailView->currentItem()) return; |
231 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 232 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
232 | 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 ) | 233 | 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 ) |
233 | { | 234 | { |
234 | mail->Wrapper()->deleteMail( mail ); | 235 | mail->Wrapper()->deleteMail( mail ); |
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 0866939..2f538c4 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -1,240 +1,240 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@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 | 19 | ||
20 | #include <qcstring.h> | 20 | #include <qcstring.h> |
21 | #include <qwhatsthis.h> | 21 | #include <qwhatsthis.h> |
22 | #include <qdialog.h> | 22 | #include <qdialog.h> |
23 | #include <qapplication.h> | 23 | #include <qapplication.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | 26 | ||
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | #include <kapplication.h> | 28 | #include <kapplication.h> |
29 | #include <libkcal/event.h> | 29 | #include <libkcal/event.h> |
30 | #include <libkcal/todo.h> | 30 | #include <libkcal/todo.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kiconloader.h> | 32 | #include <kiconloader.h> |
33 | #include <krun.h> | 33 | #include <krun.h> |
34 | #include <kglobal.h> | 34 | #include <kglobal.h> |
35 | #include <kprocess.h> | 35 | #include <kprocess.h> |
36 | #include "koprefs.h" | 36 | #include "koprefs.h" |
37 | 37 | ||
38 | #include <libkdepim/addresseeview.h> | 38 | #include <libkdepim/addresseeview.h> |
39 | #include <kabc/stdaddressbook.h> | 39 | #include <kabc/stdaddressbook.h> |
40 | 40 | ||
41 | #ifndef KORG_NODCOP | 41 | #ifndef KORG_NODCOP |
42 | #include <dcopclient.h> | 42 | #include <dcopclient.h> |
43 | #include "korganizer.h" | 43 | #include "korganizer.h" |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #include "actionmanager.h" | 45 | #include "actionmanager.h" |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | #include "koeventviewer.h" | 48 | #include "koeventviewer.h" |
49 | #ifndef KORG_NOKABC | 49 | #ifndef KORG_NOKABC |
50 | #include <kabc/stdaddressbook.h> | 50 | #include <kabc/stdaddressbook.h> |
51 | #define size count | 51 | #define size count |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #ifdef DESKTOP_VERSION | 54 | #ifdef DESKTOP_VERSION |
55 | #include <kabc/addresseedialog.h> | 55 | #include <kabc/addresseedialog.h> |
56 | #else //DESKTOP_VERSION | 56 | #else //DESKTOP_VERSION |
57 | #include <externalapphandler.h> | 57 | #include <externalapphandler.h> |
58 | #include <qtopia/qcopenvelope_qws.h> | 58 | #include <qtopia/qcopenvelope_qws.h> |
59 | #endif //DESKTOP_VERSION | 59 | #endif //DESKTOP_VERSION |
60 | 60 | ||
61 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) | 61 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) |
62 | : QTextBrowser(parent,name) | 62 | : QTextBrowser(parent,name) |
63 | { | 63 | { |
64 | mSyncMode = false; | 64 | mSyncMode = false; |
65 | mColorMode = 0; | 65 | mColorMode = 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | KOEventViewer::~KOEventViewer() | 68 | KOEventViewer::~KOEventViewer() |
69 | { | 69 | { |
70 | } | 70 | } |
71 | 71 | ||
72 | void KOEventViewer::setSource(const QString& n) | 72 | void KOEventViewer::setSource(const QString& n) |
73 | { | 73 | { |
74 | 74 | ||
75 | if ( n.left(3) == "uid" ) | 75 | if ( n.left(3) == "uid" ) |
76 | #ifdef DESKTOP_VERSION | 76 | #ifdef DESKTOP_VERSION |
77 | { | 77 | { |
78 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 78 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
79 | KABC::AddressBook::Iterator it; | 79 | KABC::AddressBook::Iterator it; |
80 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 80 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
81 | // LR I do not understand, why the uid string is different on zaurus and desktop | 81 | // LR I do not understand, why the uid string is different on zaurus and desktop |
82 | QString uid = "uid://"+(*it).uid(); | 82 | QString uid = "uid://"+(*it).uid(); |
83 | 83 | ||
84 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); | 84 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); |
85 | if (n == uid ) { | 85 | if (n == uid ) { |
86 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); | 86 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); |
87 | QDialog dia( this,"dia123", true ); | 87 | QDialog dia( this,"dia123", true ); |
88 | dia.setCaption( i18n("Details of attendee") ); | 88 | dia.setCaption( i18n("Details of attendee") ); |
89 | QVBoxLayout lay ( &dia ); | 89 | QVBoxLayout lay ( &dia ); |
90 | KPIM::AddresseeView av ( &dia ); | 90 | KPIM::AddresseeView av ( &dia ); |
91 | av.setAddressee( (*it) ); | 91 | av.setAddressee( (*it) ); |
92 | lay.addWidget( &av ); | 92 | lay.addWidget( &av ); |
93 | if ( QApplication::desktop()->width() < 480 ) | 93 | if ( QApplication::desktop()->width() < 480 ) |
94 | dia.resize( 220, 240); | 94 | dia.resize( 220, 240); |
95 | else { | 95 | else { |
96 | dia.resize( 400,400); | 96 | dia.resize( 400,400); |
97 | 97 | ||
98 | } | 98 | } |
99 | dia.exec(); | 99 | dia.exec(); |
100 | break; | 100 | break; |
101 | } | 101 | } |
102 | } | 102 | } |
103 | return; | 103 | return; |
104 | } | 104 | } |
105 | #else | 105 | #else |
106 | { | 106 | { |
107 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 107 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
108 | if (attendees.count()) { | 108 | if (attendees.count()) { |
109 | Attendee *a; | 109 | Attendee *a; |
110 | for(a=attendees.first();a;a=attendees.next()) { | 110 | for(a=attendees.first();a;a=attendees.next()) { |
111 | if ( "uid:"+a->uid() == n ) { | 111 | if ( "uid:"+a->uid() == n ) { |
112 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), ""); | 112 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); |
113 | return; | 113 | return; |
114 | } | 114 | } |
115 | } | 115 | } |
116 | } | 116 | } |
117 | return; | 117 | return; |
118 | } | 118 | } |
119 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 119 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
120 | // the result should now arrive through method insertAttendees | 120 | // the result should now arrive through method insertAttendees |
121 | //QString uid = "uid:"+(*it).uid(); | 121 | //QString uid = "uid:"+(*it).uid(); |
122 | #endif | 122 | #endif |
123 | if ( n.left(6) == "mailto" ) { | 123 | if ( n.left(6) == "mailto" ) { |
124 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); | 124 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); |
125 | #ifndef DESKTOP_VERSION | 125 | #ifndef DESKTOP_VERSION |
126 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); | 126 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); |
127 | e << n.mid(7); | 127 | e << n.mid(7); |
128 | #endif | 128 | #endif |
129 | 129 | ||
130 | } | 130 | } |
131 | 131 | ||
132 | 132 | ||
133 | #ifndef KORG_NODCOP | 133 | #ifndef KORG_NODCOP |
134 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; | 134 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; |
135 | QString tmpStr; | 135 | QString tmpStr; |
136 | if (n.startsWith("mailto:")) { | 136 | if (n.startsWith("mailto:")) { |
137 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); | 137 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); |
138 | //emit showIncidence(n); | 138 | //emit showIncidence(n); |
139 | return; | 139 | return; |
140 | } else if (n.startsWith("uid:")) { | 140 | } else if (n.startsWith("uid:")) { |
141 | DCOPClient *client = KApplication::kApplication()->dcopClient(); | 141 | DCOPClient *client = KApplication::kApplication()->dcopClient(); |
142 | const QByteArray noParamData; | 142 | const QByteArray noParamData; |
143 | const QByteArray paramData; | 143 | const QByteArray paramData; |
144 | QByteArray replyData; | 144 | QByteArray replyData; |
145 | QCString replyTypeStr; | 145 | QCString replyTypeStr; |
146 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) | 146 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) |
147 | bool foundAbbrowser = PING_ABBROWSER; | 147 | bool foundAbbrowser = PING_ABBROWSER; |
148 | 148 | ||
149 | if (foundAbbrowser) { | 149 | if (foundAbbrowser) { |
150 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor | 150 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor |
151 | //client->send("kaddressbook","KAddressBookIface", | 151 | //client->send("kaddressbook","KAddressBookIface", |
152 | QDataStream arg(paramData, IO_WriteOnly); | 152 | QDataStream arg(paramData, IO_WriteOnly); |
153 | arg << n.mid(6); | 153 | arg << n.mid(6); |
154 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); | 154 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); |
155 | return; | 155 | return; |
156 | } else { | 156 | } else { |
157 | /* | 157 | /* |
158 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. | 158 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. |
159 | We start it without its main interface | 159 | We start it without its main interface |
160 | */ | 160 | */ |
161 | KIconLoader* iconLoader = new KIconLoader(); | 161 | KIconLoader* iconLoader = new KIconLoader(); |
162 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 162 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
163 | ActionManager::setStartedKAddressBook(true); | 163 | ActionManager::setStartedKAddressBook(true); |
164 | tmpStr = "kaddressbook --editor-only --uid "; | 164 | tmpStr = "kaddressbook --editor-only --uid "; |
165 | tmpStr += KProcess::quote(n.mid(6)); | 165 | tmpStr += KProcess::quote(n.mid(6)); |
166 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 166 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
167 | return; | 167 | return; |
168 | } | 168 | } |
169 | } else { | 169 | } else { |
170 | //QTextBrowser::setSource(n); | 170 | //QTextBrowser::setSource(n); |
171 | } | 171 | } |
172 | #endif | 172 | #endif |
173 | } | 173 | } |
174 | 174 | ||
175 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 175 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
176 | { | 176 | { |
177 | int number=text.contains("\n"); | 177 | int number=text.contains("\n"); |
178 | QString str = "<" + tag + ">"; | 178 | QString str = "<" + tag + ">"; |
179 | QString tmpText=text; | 179 | QString tmpText=text; |
180 | QString tmpStr=str; | 180 | QString tmpStr=str; |
181 | if(number !=-1) | 181 | if(number !=-1) |
182 | { | 182 | { |
183 | if (number > 0) { | 183 | if (number > 0) { |
184 | int pos=0; | 184 | int pos=0; |
185 | QString tmp; | 185 | QString tmp; |
186 | for(int i=0;i<=number;i++) { | 186 | for(int i=0;i<=number;i++) { |
187 | pos=tmpText.find("\n"); | 187 | pos=tmpText.find("\n"); |
188 | tmp=tmpText.left(pos); | 188 | tmp=tmpText.left(pos); |
189 | tmpText=tmpText.right(tmpText.length()-pos-1); | 189 | tmpText=tmpText.right(tmpText.length()-pos-1); |
190 | tmpStr+=tmp+"<br>"; | 190 | tmpStr+=tmp+"<br>"; |
191 | } | 191 | } |
192 | } | 192 | } |
193 | else tmpStr += tmpText; | 193 | else tmpStr += tmpText; |
194 | tmpStr+="</" + tag + ">"; | 194 | tmpStr+="</" + tag + ">"; |
195 | mText.append(tmpStr); | 195 | mText.append(tmpStr); |
196 | } | 196 | } |
197 | else | 197 | else |
198 | { | 198 | { |
199 | str += text + "</" + tag + ">"; | 199 | str += text + "</" + tag + ">"; |
200 | mText.append(str); | 200 | mText.append(str); |
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||
204 | void KOEventViewer::setColorMode( int m ) | 204 | void KOEventViewer::setColorMode( int m ) |
205 | { | 205 | { |
206 | mColorMode = m; | 206 | mColorMode = m; |
207 | } | 207 | } |
208 | void KOEventViewer::appendEvent(Event *event, int mode ) | 208 | void KOEventViewer::appendEvent(Event *event, int mode ) |
209 | { | 209 | { |
210 | mMailSubject = ""; | 210 | mMailSubject = ""; |
211 | mCurrentIncidence = event; | 211 | mCurrentIncidence = event; |
212 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 212 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
213 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 213 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
214 | if ( mode == 0 ) { | 214 | if ( mode == 0 ) { |
215 | addTag("h2",event->summary()); | 215 | addTag("h2",event->summary()); |
216 | } | 216 | } |
217 | else { | 217 | else { |
218 | if ( mColorMode == 1 ) { | 218 | if ( mColorMode == 1 ) { |
219 | mText +="<font color=\"#00A000\">"; | 219 | mText +="<font color=\"#00A000\">"; |
220 | } | 220 | } |
221 | if ( mColorMode == 2 ) { | 221 | if ( mColorMode == 2 ) { |
222 | mText +="<font color=\"#C00000\">"; | 222 | mText +="<font color=\"#C00000\">"; |
223 | } | 223 | } |
224 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 224 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
225 | if ( mode == 1 ) { | 225 | if ( mode == 1 ) { |
226 | addTag("h2",i18n( "Local: " ) +event->summary()); | 226 | addTag("h2",i18n( "Local: " ) +event->summary()); |
227 | } else { | 227 | } else { |
228 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 228 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
229 | } | 229 | } |
230 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 230 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
231 | if ( mColorMode ) | 231 | if ( mColorMode ) |
232 | mText += "</font>"; | 232 | mText += "</font>"; |
233 | } | 233 | } |
234 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 234 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
235 | if (event->cancelled ()) { | 235 | if (event->cancelled ()) { |
236 | mText +="<font color=\"#B00000\">"; | 236 | mText +="<font color=\"#B00000\">"; |
237 | addTag("i",i18n("This event has been cancelled!")); | 237 | addTag("i",i18n("This event has been cancelled!")); |
238 | mText.append("<br>"); | 238 | mText.append("<br>"); |
239 | mText += "</font>"; | 239 | mText += "</font>"; |
240 | mMailSubject += i18n("(cancelled)"); | 240 | mMailSubject += i18n("(cancelled)"); |