Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
9d5105ba
Commit
9d5105ba
authored
Mar 15, 2016
by
Craig Watson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if location is writable before exporting to PDF
parent
97b8ff49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
4 deletions
+22
-4
UBExportFullPDF.cpp
src/adaptors/UBExportFullPDF.cpp
+21
-3
UBExportFullPDF.h
src/adaptors/UBExportFullPDF.h
+1
-1
No files found.
src/adaptors/UBExportFullPDF.cpp
View file @
9d5105ba
...
...
@@ -142,8 +142,8 @@ void UBExportFullPDF::persist(UBDocumentProxy* pDocumentProxy)
if
(
mIsVerbose
)
UBApplication
::
showMessage
(
tr
(
"Exporting document..."
));
persistsDocument
(
pDocumentProxy
,
filename
);
if
(
mIsVerbose
)
bool
success
=
persistsDocument
(
pDocumentProxy
,
filename
);
if
(
mIsVerbose
&&
success
)
UBApplication
::
showMessage
(
tr
(
"Export successful."
));
QApplication
::
restoreOverrideCursor
();
...
...
@@ -151,8 +151,24 @@ void UBExportFullPDF::persist(UBDocumentProxy* pDocumentProxy)
}
void
UBExportFullPDF
::
persistsDocument
(
UBDocumentProxy
*
pDocumentProxy
,
const
QString
&
filename
)
bool
UBExportFullPDF
::
persistsDocument
(
UBDocumentProxy
*
pDocumentProxy
,
const
QString
&
filename
)
{
QFileInfo
info
(
filename
);
info
.
setFile
(
info
.
absolutePath
());
if
(
!
info
.
isWritable
())
{
UBApplication
::
showMessage
(
tr
(
"Export failed: location not writable"
));
// The message is a bit discreet: also show a pop-up
QMessageBox
errorBox
;
errorBox
.
setWindowTitle
(
tr
(
"Export failed"
));
errorBox
.
setText
(
tr
(
"Unable to export to the selected location. You do not have the permissions necessary to save the file."
));
errorBox
.
setIcon
(
QMessageBox
::
Critical
);
errorBox
.
exec
();
return
false
;
}
QFile
file
(
filename
);
if
(
file
.
exists
())
file
.
remove
();
...
...
@@ -269,6 +285,8 @@ void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS
QFile
::
remove
(
overlayName
);
}
}
return
true
;
}
...
...
src/adaptors/UBExportFullPDF.h
View file @
9d5105ba
...
...
@@ -45,7 +45,7 @@ class UBExportFullPDF : public UBExportAdaptor
virtual
QString
exportExtention
();
virtual
void
persist
(
UBDocumentProxy
*
pDocument
);
virtual
void
persistsDocument
(
UBDocumentProxy
*
pDocument
,
const
QString
&
filename
);
virtual
bool
persistsDocument
(
UBDocumentProxy
*
pDocument
,
const
QString
&
filename
);
protected
:
void
saveOverlayPdf
(
UBDocumentProxy
*
pDocumentProxy
,
const
QString
&
filename
);
...
...
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