Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
KAlarm
Commits
65da58f2
Commit
65da58f2
authored
Jul 22, 2005
by
David Jarvie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused code
svn path=/trunk/KDE/kdepim/; revision=437679
parent
cd377c37
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
62 deletions
+37
-62
kamail.cpp
kamail.cpp
+37
-62
No files found.
kamail.cpp
View file @
65da58f2
...
...
@@ -226,76 +226,51 @@ bool KAMail::send(const KAEvent& event, QStringList& errmsgs, bool allowNotify)
QString
KAMail
::
sendKMail
(
const
KAMailData
&
data
)
{
QString
err
=
KAlarm
::
runKMail
(
true
);
if
(
err
.
isNull
())
if
(
!
err
.
isNull
())
return
err
;
// KMail is now running. Determine which DCOP call to use.
bool
useSend
=
false
;
QCString
sendFunction
=
"sendMessage(QString,QString,QString,QString,QString,QString,KURL::List)"
;
QCStringList
funcs
=
kapp
->
dcopClient
()
->
remoteFunctions
(
"kmail"
,
"MailTransportServiceIface"
);
for
(
QCStringList
::
Iterator
it
=
funcs
.
begin
();
it
!=
funcs
.
end
()
&&
!
useSend
;
++
it
)
{
// KMail is running - use a DCOP call.
// First, determine which DCOP call to use.
bool
useSend
=
false
;
QCString
sendFunction
=
"sendMessage(QString,QString,QString,QString,QString,QString,KURL::List)"
;
QCStringList
funcs
=
kapp
->
dcopClient
()
->
remoteFunctions
(
"kmail"
,
"MailTransportServiceIface"
);
for
(
QCStringList
::
Iterator
it
=
funcs
.
begin
();
it
!=
funcs
.
end
()
&&
!
useSend
;
++
it
)
QCString
func
=
DCOPClient
::
normalizeFunctionSignature
(
*
it
);
if
(
func
.
left
(
5
)
==
"bool "
)
{
QCString
func
=
DCOPClient
::
normalizeFunctionSignature
(
*
it
);
if
(
func
.
left
(
5
)
==
"bool "
)
{
func
=
func
.
mid
(
5
);
func
.
replace
(
QRegExp
(
" [0-9A-Za-z_:]+"
),
""
);
useSend
=
(
func
==
sendFunction
);
}
func
=
func
.
mid
(
5
);
func
.
replace
(
QRegExp
(
" [0-9A-Za-z_:]+"
),
""
);
useSend
=
(
func
==
sendFunction
);
}
}
QByteArray
callData
;
QDataStream
arg
(
callData
,
IO_WriteOnly
);
kdDebug
(
5950
)
<<
"KAMail::sendKMail(): using "
<<
(
useSend
?
"sendMessage()"
:
"dcopAddMessage()"
)
<<
endl
;
if
(
useSend
)
{
// This version of KMail has the sendMessage() function,
// which transmits the message immediately.
arg
<<
data
.
from
;
arg
<<
data
.
event
.
emailAddresses
(
", "
);
arg
<<
""
;
// CC:
arg
<<
data
.
bcc
;
arg
<<
data
.
event
.
emailSubject
();
arg
<<
data
.
event
.
message
();
arg
<<
KURL
::
List
(
data
.
event
.
emailAttachments
());
if
(
!
callKMail
(
callData
,
"MailTransportServiceIface"
,
sendFunction
,
"bool"
))
return
i18n
(
"Error calling KMail"
);
}
else
{
// KMail is an older version, so use dcopAddMessage()
// to add the message to the outbox for later transmission.
err
=
addToKMailFolder
(
data
,
"outbox"
,
false
);
if
(
!
err
.
isNull
())
return
err
;
}
if
(
data
.
allowNotify
)
notifyQueued
(
data
.
event
);
QByteArray
callData
;
QDataStream
arg
(
callData
,
IO_WriteOnly
);
kdDebug
(
5950
)
<<
"KAMail::sendKMail(): using "
<<
(
useSend
?
"sendMessage()"
:
"dcopAddMessage()"
)
<<
endl
;
if
(
useSend
)
{
// This version of KMail has the sendMessage() function,
// which transmits the message immediately.
arg
<<
data
.
from
;
arg
<<
data
.
event
.
emailAddresses
(
", "
);
arg
<<
""
;
// CC:
arg
<<
data
.
bcc
;
arg
<<
data
.
event
.
emailSubject
();
arg
<<
data
.
event
.
message
();
arg
<<
KURL
::
List
(
data
.
event
.
emailAttachments
());
if
(
!
callKMail
(
callData
,
"MailTransportServiceIface"
,
sendFunction
,
"bool"
))
return
i18n
(
"Error calling KMail"
);
}
else
{
// KMail isn't running - try to start it via the command line
KProcess
proc
;
proc
<<
"kmail"
<<
"--subject"
<<
data
.
event
.
emailSubject
().
local8Bit
()
<<
"--body"
<<
data
.
event
.
message
().
local8Bit
();
if
(
!
data
.
bcc
.
isEmpty
())
proc
<<
"--bcc"
<<
data
.
bcc
.
local8Bit
();
QStringList
attachments
=
data
.
event
.
emailAttachments
();
if
(
attachments
.
count
())
{
for
(
QStringList
::
Iterator
at
=
attachments
.
begin
();
at
!=
attachments
.
end
();
++
at
)
proc
<<
"--attach"
<<
(
*
at
).
local8Bit
();
}
EmailAddressList
addresses
=
data
.
event
.
emailAddresses
();
for
(
EmailAddressList
::
Iterator
ad
=
addresses
.
begin
();
ad
!=
addresses
.
end
();
++
ad
)
proc
<<
(
*
ad
).
fullName
().
local8Bit
();
if
(
!
proc
.
start
(
KProcess
::
DontCare
))
{
kdDebug
(
5950
)
<<
"sendKMail(): kmail start failed"
<<
endl
;
return
i18n
(
"Error starting KMail"
);
}
// KMail is an older version, so use dcopAddMessage()
// to add the message to the outbox for later transmission.
err
=
addToKMailFolder
(
data
,
"outbox"
,
false
);
if
(
!
err
.
isNull
())
return
err
;
}
if
(
data
.
allowNotify
)
notifyQueued
(
data
.
event
);
return
QString
::
null
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment