Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KMail
Commits
3ccf1aaa
Commit
3ccf1aaa
authored
Sep 22, 2021
by
Laurent Montel
😁
Browse files
Const'ify variables
parent
29610906
Pipeline
#82169
passed with stage
in 26 minutes and 6 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ktnef/src/attachpropertydialog.cpp
View file @
3ccf1aaa
...
...
@@ -96,8 +96,8 @@ void AttachPropertyDialog::setAttachment(KTNEFAttach *attach)
s
.
append
(
i18n
(
" bytes"
));
mUI
.
mSize
->
setText
(
s
);
QMimeDatabase
db
;
QMimeType
mimetype
=
db
.
mimeTypeForName
(
attach
->
mimeTag
());
QPixmap
pix
=
loadRenderingPixmap
(
attach
,
qApp
->
palette
().
color
(
QPalette
::
Window
));
const
QMimeType
mimetype
=
db
.
mimeTypeForName
(
attach
->
mimeTag
());
const
QPixmap
pix
=
loadRenderingPixmap
(
attach
,
qApp
->
palette
().
color
(
QPalette
::
Window
));
if
(
!
pix
.
isNull
())
{
mUI
.
mIcon
->
setPixmap
(
pix
);
}
else
{
...
...
@@ -161,13 +161,13 @@ void AttachPropertyDialog::formatPropertySet(KTNEFPropertySet *pSet, QTreeWidget
bool
AttachPropertyDialog
::
saveProperty
(
QTreeWidget
*
lv
,
KTNEFPropertySet
*
pSet
,
QWidget
*
parent
)
{
QList
<
QTreeWidgetItem
*>
list
=
lv
->
selectedItems
();
const
QList
<
QTreeWidgetItem
*>
list
=
lv
->
selectedItems
();
if
(
list
.
isEmpty
())
{
KMessageBox
::
error
(
parent
,
i18nc
(
"@info"
,
"Must select an item first."
));
return
false
;
}
QTreeWidgetItem
*
item
=
list
.
f
irst
();
QTreeWidgetItem
*
item
=
list
.
constF
irst
();
if
(
item
->
text
(
2
).
isEmpty
())
{
KMessageBox
::
error
(
parent
,
i18nc
(
"@info"
,
"The selected item cannot be saved because it has an empty tag."
));
}
else
{
...
...
ktnef/src/ktnefmain.cpp
View file @
3ccf1aaa
...
...
@@ -192,7 +192,7 @@ void KTNEFMain::loadFile(const QString &filename)
KMessageBox
::
error
(
this
,
i18nc
(
"@info"
,
"Unable to open file
\"
%1
\"
."
,
filename
));
}
else
{
addRecentFile
(
QUrl
::
fromLocalFile
(
filename
));
QList
<
KTNEFAttach
*>
list
=
mParser
->
message
()
->
attachmentList
();
const
QList
<
KTNEFAttach
*>
list
=
mParser
->
message
()
->
attachmentList
();
QString
msg
;
msg
=
i18ncp
(
"@info:status"
,
"%1 attachment found"
,
"%1 attachments found"
,
list
.
count
());
statusBar
()
->
showMessage
(
msg
);
...
...
@@ -261,8 +261,7 @@ QString KTNEFMain::extractTemp(KTNEFAttach *att)
void
KTNEFMain
::
viewFileAs
()
{
if
(
!
mView
->
getSelection
().
isEmpty
())
{
QList
<
QUrl
>
list
;
list
.
append
(
QUrl
::
fromLocalFile
(
extractTemp
(
mView
->
getSelection
().
at
(
0
))));
const
QList
<
QUrl
>
list
{
QUrl
::
fromLocalFile
(
extractTemp
(
mView
->
getSelection
().
at
(
0
)))};
if
(
!
list
.
isEmpty
())
{
// Creating ApplicationLauncherJob without any args will invoke the open-with dialog
...
...
@@ -296,7 +295,7 @@ void KTNEFMain::extractAllFiles()
if
(
!
dir
.
isEmpty
())
{
mLastDir
=
dir
;
dir
.
append
(
QLatin1Char
(
'/'
));
QList
<
KTNEFAttach
*>
list
=
mParser
->
message
()
->
attachmentList
();
const
QList
<
KTNEFAttach
*>
list
=
mParser
->
message
()
->
attachmentList
();
QList
<
KTNEFAttach
*>::
ConstIterator
it
;
QList
<
KTNEFAttach
*>::
ConstIterator
end
(
list
.
constEnd
());
for
(
it
=
list
.
constBegin
();
it
!=
end
;
++
it
)
{
...
...
@@ -372,7 +371,7 @@ void KTNEFMain::extractTo(const QString &dirname)
if
(
dir
.
right
(
1
)
!=
QLatin1Char
(
'/'
))
{
dir
.
append
(
QLatin1Char
(
'/'
));
}
QList
<
KTNEFAttach
*>
list
=
mView
->
getSelection
();
const
QList
<
KTNEFAttach
*>
list
=
mView
->
getSelection
();
QList
<
KTNEFAttach
*>::
ConstIterator
it
;
QList
<
KTNEFAttach
*>::
ConstIterator
end
(
list
.
constEnd
());
for
(
it
=
list
.
constBegin
();
it
!=
end
;
++
it
)
{
...
...
@@ -385,7 +384,7 @@ void KTNEFMain::extractTo(const QString &dirname)
void
KTNEFMain
::
contextMenuEvent
(
QContextMenuEvent
*
event
)
{
QList
<
KTNEFAttach
*>
list
=
mView
->
getSelection
();
const
QList
<
KTNEFAttach
*>
list
=
mView
->
getSelection
();
if
(
list
.
isEmpty
())
{
return
;
}
...
...
@@ -426,6 +425,7 @@ void KTNEFMain::viewDragRequested(const QList<KTnef::KTNEFAttach *> &list)
{
QList
<
QUrl
>
urlList
;
QList
<
KTNEFAttach
*>::
ConstIterator
end
(
list
.
constEnd
());
urlList
.
reserve
(
list
.
count
());
for
(
QList
<
KTNEFAttach
*>::
ConstIterator
it
=
list
.
constBegin
();
it
!=
end
;
++
it
)
{
urlList
<<
QUrl
::
fromLocalFile
(
extractTemp
(
*
it
));
}
...
...
@@ -493,8 +493,8 @@ void KTNEFMain::slotSaveMessageText()
return
;
}
QString
rtf
=
mParser
->
message
()
->
rtfString
();
QString
filename
=
QFileDialog
::
getSaveFileName
(
this
,
QString
(),
QString
(),
QString
());
const
QString
rtf
=
mParser
->
message
()
->
rtfString
();
const
QString
filename
=
QFileDialog
::
getSaveFileName
(
this
,
QString
(),
QString
(),
QString
());
if
(
!
filename
.
isEmpty
())
{
QFile
f
(
filename
);
if
(
f
.
open
(
QIODevice
::
WriteOnly
))
{
...
...
@@ -542,7 +542,7 @@ void KTNEFMain::createOpenWithMenu(QMenu *topMenu)
return
;
}
KTNEFAttach
*
attach
=
mView
->
getSelection
().
at
(
0
);
QString
mimename
(
attach
->
mimeTag
());
const
QString
mimename
(
attach
->
mimeTag
());
const
KService
::
List
offers
=
KFileItemActions
::
associatedApplications
(
QStringList
()
<<
mimename
);
if
(
!
offers
.
isEmpty
())
{
QMenu
*
menu
=
topMenu
;
...
...
ktnef/src/ktnefview.cpp
View file @
3ccf1aaa
...
...
@@ -50,7 +50,7 @@ Attachment::Attachment(QTreeWidget *parent, KTNEFAttach *attach)
}
QMimeDatabase
db
;
QMimeType
mimeType
=
db
.
mimeTypeForName
(
mAttach
->
mimeTag
());
const
QMimeType
mimeType
=
db
.
mimeTypeForName
(
mAttach
->
mimeTag
());
setText
(
1
,
mimeType
.
comment
());
QPixmap
pix
=
AttachPropertyDialog
::
loadRenderingPixmap
(
attach
,
qApp
->
palette
().
color
(
QPalette
::
Window
));
...
...
Write
Preview
Supports
Markdown
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