Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KDE Pim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Unmaintained
KDE Pim
Commits
812e301a
Commit
812e301a
authored
Dec 08, 2014
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Bug 340818 - Tries to attach directories
FIXED-IN: 14.12 BUG: 340818
parent
12adc93d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
29 deletions
+71
-29
kmail/editor/kmcomposewin.cpp
kmail/editor/kmcomposewin.cpp
+1
-1
messagecomposer/attachment/attachmentcontrollerbase.cpp
messagecomposer/attachment/attachmentcontrollerbase.cpp
+63
-26
messagecomposer/attachment/attachmentcontrollerbase.h
messagecomposer/attachment/attachmentcontrollerbase.h
+6
-1
messagecomposer/composer/composerviewbase.cpp
messagecomposer/composer/composerviewbase.cpp
+1
-1
No files found.
kmail/editor/kmcomposewin.cpp
View file @
812e301a
...
...
@@ -3468,7 +3468,7 @@ void KMComposeWin::slotCreateAddressBookContact()
void
KMComposeWin
::
slotAttachMissingFile
()
{
mComposerBase
->
attachmentController
()
->
showAddAttachmentDialog
();
mComposerBase
->
attachmentController
()
->
showAddAttachment
File
Dialog
();
}
void
KMComposeWin
::
slotVerifyMissingAttachmentTimeout
()
...
...
messagecomposer/attachment/attachmentcontrollerbase.cpp
View file @
812e301a
...
...
@@ -119,7 +119,8 @@ public:
QAction
*
saveAsContextAction
;
QAction
*
propertiesAction
;
QAction
*
propertiesContextAction
;
QAction
*
addAction
;
QAction
*
addAttachmentFileAction
;
QAction
*
addAttachmentDirectoryAction
;
QAction
*
addContextAction
;
QAction
*
selectAllAction
;
KActionMenu
*
attachmentMenu
;
...
...
@@ -148,7 +149,8 @@ AttachmentControllerBase::Private::Private( AttachmentControllerBase *qq )
,
saveAsContextAction
(
0
)
,
propertiesAction
(
0
)
,
propertiesContextAction
(
0
)
,
addAction
(
0
)
,
addAttachmentFileAction
(
0
)
,
addAttachmentDirectoryAction
(
0
)
,
addContextAction
(
0
)
,
selectAllAction
(
0
)
,
attachmentMenu
(
0
)
...
...
@@ -460,23 +462,29 @@ void AttachmentControllerBase::createActions()
connect
(
d
->
attachMyPublicKeyAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
attachMyPublicKey
())
);
d
->
attachmentMenu
=
new
KActionMenu
(
KIcon
(
QLatin1String
(
"mail-attachment"
)
),
i18n
(
"Attach"
),
this
);
connect
(
d
->
attachmentMenu
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
showAddAttachmentDialog
())
);
connect
(
d
->
attachmentMenu
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
showAddAttachment
File
Dialog
())
);
d
->
attachmentMenu
->
setDelayed
(
true
);
d
->
addAction
=
new
KAction
(
KIcon
(
QLatin1String
(
"mail-attachment"
)
),
i18n
(
"&Attach File..."
),
this
);
d
->
addAction
->
setIconText
(
i18n
(
"Attach"
)
);
d
->
addA
ttachmentFileA
ction
=
new
KAction
(
KIcon
(
QLatin1String
(
"mail-attachment"
)
),
i18n
(
"&Attach File..."
),
this
);
d
->
addA
ttachmentFileA
ction
->
setIconText
(
i18n
(
"Attach"
)
);
d
->
addContextAction
=
new
KAction
(
KIcon
(
QLatin1String
(
"mail-attachment"
)
),
i18n
(
"Add Attachment..."
),
this
);
connect
(
d
->
addAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
showAddAttachmentDialog
())
);
connect
(
d
->
addContextAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
showAddAttachmentDialog
())
);
connect
(
d
->
addAttachmentFileAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
showAddAttachmentFileDialog
())
);
connect
(
d
->
addContextAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
showAddAttachmentFileDialog
())
);
d
->
addAttachmentDirectoryAction
=
new
KAction
(
KIcon
(
QLatin1String
(
"mail-attachment"
)
),
i18n
(
"&Attach Directory..."
),
this
);
d
->
addAttachmentDirectoryAction
->
setIconText
(
i18n
(
"Attach"
)
);
connect
(
d
->
addAttachmentDirectoryAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
showAddAttachmentCompressedDirectoryDialog
())
);
d
->
addOwnVcardAction
=
new
KAction
(
i18n
(
"Attach Own vCard"
),
this
);
d
->
addOwnVcardAction
->
setIconText
(
i18n
(
"Own vCard"
)
);
d
->
addOwnVcardAction
->
setCheckable
(
true
);
connect
(
d
->
addOwnVcardAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SIGNAL
(
addOwnVcard
(
bool
)));
d
->
attachmentMenu
->
addAction
(
d
->
addAction
);
d
->
attachmentMenu
->
addAction
(
d
->
addAttachmentFileAction
);
d
->
attachmentMenu
->
addAction
(
d
->
addAttachmentDirectoryAction
);
d
->
attachmentMenu
->
addSeparator
();
d
->
attachmentMenu
->
addAction
(
d
->
addOwnVcardAction
);
...
...
@@ -526,7 +534,8 @@ void AttachmentControllerBase::createActions()
KActionCollection
*
collection
=
d
->
mActionCollection
;
collection
->
addAction
(
QLatin1String
(
"attach_public_key"
),
d
->
attachPublicKeyAction
);
collection
->
addAction
(
QLatin1String
(
"attach_my_public_key"
),
d
->
attachMyPublicKeyAction
);
collection
->
addAction
(
QLatin1String
(
"attach"
),
d
->
addAction
);
collection
->
addAction
(
QLatin1String
(
"attach"
),
d
->
addAttachmentFileAction
);
collection
->
addAction
(
QLatin1String
(
"attach_directory"
),
d
->
addAttachmentDirectoryAction
);
collection
->
addAction
(
QLatin1String
(
"remove"
),
d
->
removeAction
);
collection
->
addAction
(
QLatin1String
(
"attach_save"
),
d
->
saveAsAction
);
collection
->
addAction
(
QLatin1String
(
"attach_properties"
),
d
->
propertiesAction
);
...
...
@@ -810,21 +819,11 @@ void AttachmentControllerBase::attachmentProperties( AttachmentPart::Ptr part )
delete
dialog
;
}
void
AttachmentControllerBase
::
showAddAttachmentDialog
(
)
void
AttachmentControllerBase
::
attachFileDirectory
(
const
KUrl
::
List
&
urls
,
const
QString
&
encoding
)
{
#ifndef KDEPIM_MOBILE_UI
QPointer
<
KEncodingFileDialog
>
dialog
=
new
KEncodingFileDialog
(
QString
(
/*startDir*/
),
QString
(
/*encoding*/
),
QString
(
/*filter*/
),
i18n
(
"Attach File"
),
KFileDialog
::
Other
,
d
->
wParent
);
dialog
->
okButton
()
->
setGuiItem
(
KGuiItem
(
i18n
(
"&Attach"
),
QLatin1String
(
"document-open"
)
)
);
dialog
->
setMode
(
KFile
::
Files
|
KFile
::
Directory
);
if
(
dialog
->
exec
()
==
KDialog
::
Accepted
&&
dialog
)
{
const
KUrl
::
List
files
=
dialog
->
selectedUrls
();
const
QString
encoding
=
MessageViewer
::
NodeHelper
::
fixEncoding
(
dialog
->
selectedEncoding
()
);
const
int
numberOfFiles
(
files
.
count
());
const
int
numberOfFiles
(
urls
.
count
());
for
(
int
i
=
0
;
i
<
numberOfFiles
;
++
i
)
{
const
KUrl
url
=
file
s
.
at
(
i
);
const
KUrl
url
=
url
s
.
at
(
i
);
KUrl
urlWithEncoding
=
url
;
urlWithEncoding
.
setFileEncoding
(
encoding
);
if
(
KMimeType
::
findByUrl
(
urlWithEncoding
)
->
name
()
==
QLatin1String
(
"inode/directory"
)
)
{
...
...
@@ -836,6 +835,44 @@ void AttachmentControllerBase::showAddAttachmentDialog()
addAttachment
(
urlWithEncoding
);
}
}
}
void
AttachmentControllerBase
::
showAddAttachmentCompressedDirectoryDialog
()
{
#ifndef KDEPIM_MOBILE_UI
QPointer
<
KEncodingFileDialog
>
dialog
=
new
KEncodingFileDialog
(
QString
(
/*startDir*/
),
QString
(
/*encoding*/
),
QString
(
/*filter*/
),
i18n
(
"Attach Directory"
),
KFileDialog
::
Other
,
d
->
wParent
);
dialog
->
okButton
()
->
setGuiItem
(
KGuiItem
(
i18n
(
"&Attach"
),
QLatin1String
(
"document-open"
)
)
);
dialog
->
setMode
(
KFile
::
Directory
);
if
(
dialog
->
exec
()
==
KDialog
::
Accepted
&&
dialog
)
{
const
QString
encoding
=
MessageViewer
::
NodeHelper
::
fixEncoding
(
dialog
->
selectedEncoding
()
);
attachFileDirectory
(
dialog
->
selectedUrls
(),
encoding
);
}
delete
dialog
;
#else
// use native dialog, while being much simpler, it actually fits on the screen much better than our own monster dialog
const
QString
fileName
=
KFileDialog
::
getExistingDirectory
(
KUrl
(),
QString
(),
d
->
wParent
,
i18n
(
"Attach Directory"
)
);
if
(
!
fileName
.
isEmpty
()
)
{
addAttachment
(
KUrl
::
fromLocalFile
(
fileName
)
);
}
#endif
}
void
AttachmentControllerBase
::
showAddAttachmentFileDialog
()
{
#ifndef KDEPIM_MOBILE_UI
QPointer
<
KEncodingFileDialog
>
dialog
=
new
KEncodingFileDialog
(
QString
(
/*startDir*/
),
QString
(
/*encoding*/
),
QString
(
/*filter*/
),
i18n
(
"Attach File"
),
KFileDialog
::
Other
,
d
->
wParent
);
dialog
->
okButton
()
->
setGuiItem
(
KGuiItem
(
i18n
(
"&Attach"
),
QLatin1String
(
"document-open"
)
)
);
dialog
->
setMode
(
KFile
::
Files
);
if
(
dialog
->
exec
()
==
KDialog
::
Accepted
&&
dialog
)
{
const
QString
encoding
=
MessageViewer
::
NodeHelper
::
fixEncoding
(
dialog
->
selectedEncoding
()
);
attachFileDirectory
(
dialog
->
selectedUrls
(),
encoding
);
}
delete
dialog
;
#else
...
...
messagecomposer/attachment/attachmentcontrollerbase.h
View file @
812e301a
...
...
@@ -73,7 +73,8 @@ public slots:
void
editAttachmentWith
(
MessageCore
::
AttachmentPart
::
Ptr
part
);
void
saveAttachmentAs
(
MessageCore
::
AttachmentPart
::
Ptr
part
);
void
attachmentProperties
(
MessageCore
::
AttachmentPart
::
Ptr
part
);
void
showAddAttachmentDialog
();
void
showAddAttachmentFileDialog
();
void
showAddAttachmentCompressedDirectoryDialog
();
/// sets sign, encrypt, shows properties dialog if so configured
void
addAttachment
(
MessageCore
::
AttachmentPart
::
Ptr
part
);
void
addAttachment
(
const
KUrl
&
url
);
...
...
@@ -96,6 +97,10 @@ protected:
void
enableAttachMyPublicKey
(
bool
enable
);
void
byteArrayToRemoteFile
(
const
QByteArray
&
aData
,
const
KUrl
&
aURL
,
bool
overwrite
=
false
);
void
openWith
(
KService
::
Ptr
offer
=
KService
::
Ptr
());
private:
void
attachFileDirectory
(
const
KUrl
::
List
&
urls
,
const
QString
&
encoding
);
private
slots
:
void
slotPutResult
(
KJob
*
job
);
void
slotOpenWithDialog
();
...
...
messagecomposer/composer/composerviewbase.cpp
View file @
812e301a
...
...
@@ -1629,7 +1629,7 @@ MessageComposer::ComposerViewBase::MissingAttachment MessageComposer::ComposerVi
if
(
rc
==
KMessageBox
::
Cancel
)
return
FoundMissingAttachmentAndCancel
;
if
(
rc
==
KMessageBox
::
Yes
)
{
m_attachmentController
->
showAddAttachmentDialog
();
m_attachmentController
->
showAddAttachment
File
Dialog
();
return
FoundMissingAttachmentAndAddedAttachment
;
}
...
...
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