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
Krita
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
Tusooa Zhu
Krita
Commits
3fe6ab9e
Commit
3fe6ab9e
authored
Dec 22, 2016
by
Halla Rempt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG:373908 Show the filename in the file dialog on save as
parent
64a4c9e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
libs/widgetutils/KoFileDialog.cpp
libs/widgetutils/KoFileDialog.cpp
+6
-4
libs/widgetutils/KoFileDialog.h
libs/widgetutils/KoFileDialog.h
+7
-1
No files found.
libs/widgetutils/KoFileDialog.cpp
View file @
3fe6ab9e
...
...
@@ -59,6 +59,7 @@ public:
QString
dialogName
;
QString
caption
;
QString
defaultDirectory
;
QString
proposedFileName
;
QStringList
filterList
;
QString
defaultFilter
;
QScopedPointer
<
QFileDialog
>
fileDialog
;
...
...
@@ -90,6 +91,7 @@ void KoFileDialog::setDefaultDir(const QString &defaultDir)
QFileInfo
f
(
defaultDir
);
d
->
defaultDirectory
=
f
.
absoluteFilePath
();
}
d
->
proposedFileName
=
QFileInfo
(
defaultDir
).
fileName
();
}
void
KoFileDialog
::
setImageFilters
()
...
...
@@ -127,9 +129,9 @@ QString KoFileDialog::selectedMimeType() const
void
KoFileDialog
::
createFileDialog
()
{
//qDebug() << "createFileDialog. Parent:" << d->parent << "Caption:" << d->caption << "Default directory:" << d->defaultDirectory << "
Default if
lter:" << d->defaultFilter;
//qDebug() << "createFileDialog. Parent:" << d->parent << "Caption:" << d->caption << "Default directory:" << d->defaultDirectory << "
proposed filename" << d->proposedFileName << "Default fi
lter:" << d->defaultFilter;
d
->
fileDialog
.
reset
(
new
QFileDialog
(
d
->
parent
,
d
->
caption
,
d
->
defaultDirectory
));
d
->
fileDialog
.
reset
(
new
QFileDialog
(
d
->
parent
,
d
->
caption
,
d
->
defaultDirectory
+
"/"
+
d
->
proposedFileName
));
bool
dontUseNative
=
false
;
#ifdef Q_OS_UNIX
if
(
qgetenv
(
"XDG_CURRENT_DESKTOP"
)
!=
"KDE"
)
{
...
...
@@ -176,9 +178,9 @@ void KoFileDialog::createFileDialog()
d
->
fileDialog
->
setNameFilters
(
d
->
filterList
);
if
(
!
QFileInfo
(
d
->
defaultDirectory
).
isDir
())
{
if
(
!
d
->
proposedFileName
.
isEmpty
())
{
//qDebug() << "Finding the right mimetype for the given file" << d->defaultDirectory;
QString
mime
=
KisMimeDatabase
::
mimeTypeForFile
(
d
->
defaultDirectory
);
QString
mime
=
KisMimeDatabase
::
mimeTypeForFile
(
d
->
proposedFileName
);
QString
description
=
KisMimeDatabase
::
descriptionForMimeType
(
mime
);
Q_FOREACH
(
const
QString
&
filter
,
d
->
filterList
)
{
//qDebug() << "\tConsidering" << filter;
...
...
libs/widgetutils/KoFileDialog.h
View file @
3fe6ab9e
...
...
@@ -65,8 +65,14 @@ public:
void
setCaption
(
const
QString
&
caption
);
/**
* Use the given filename as a proposal.
*/
void
setProposedFileName
(
const
QString
&
filename
);
/**
* @brief setDefaultDir set the default directory to defaultDir
* @brief setDefaultDir set the default directory to defaultDir
.
*
* @param defaultDir a path to a file or directory
*/
...
...
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