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
e17a2fd6
Commit
e17a2fd6
authored
Dec 07, 2011
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
87ef37b7
74162faf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
9 deletions
+36
-9
UBApplication.cpp
src/core/UBApplication.cpp
+10
-3
UBLibPathViewer.cpp
src/gui/UBLibPathViewer.cpp
+25
-6
UBLibraryWidget.cpp
src/gui/UBLibraryWidget.cpp
+1
-0
No files found.
src/core/UBApplication.cpp
View file @
e17a2fd6
...
...
@@ -643,15 +643,22 @@ QString UBApplication::globalStyleSheet()
QString
UBApplication
::
urlFromHtml
(
QString
html
)
{
qDebug
()
<<
"HTML: "
<<
html
.
remove
(
QRegExp
(
"[
\\
0]"
));
QString
url
;
QDomDocument
domDoc
;
domDoc
.
setContent
(
html
.
remove
(
QRegExp
(
"[
\\
0]"
)));
QDomElement
rootElem
=
domDoc
.
documentElement
();
url
=
rootElem
.
attribute
(
"src"
);
// QUICKFIX: Here we have to check rootElem. Sometimes it can be a <meta> tag
// In such a case we will not be able to retrieve the src value
if
(
rootElem
.
tagName
().
toLower
().
contains
(
"meta"
)){
qDebug
()
<<
rootElem
.
firstChildElement
().
tagName
();
// In that case we get the next element
url
=
rootElem
.
firstChildElement
().
attribute
(
"src"
);
}
else
{
url
=
rootElem
.
attribute
(
"src"
);
}
qDebug
()
<<
"The URL is: "
<<
url
;
return
url
;
}
...
...
src/gui/UBLibPathViewer.cpp
View file @
e17a2fd6
...
...
@@ -478,9 +478,8 @@ void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
}
bAccept
=
true
;
}
else
if
(
NULL
!=
event
->
mimeData
()
&&
event
->
mimeData
()
->
hasUrls
()){
QList
<
QUrl
>
urls
=
event
->
mimeData
()
->
urls
();
}
else
if
(
NULL
!=
pMimeData
&&
pMimeData
->
hasUrls
()){
QList
<
QUrl
>
urls
=
pMimeData
->
urls
();
foreach
(
QUrl
eachUrl
,
urls
){
QString
sUrl
=
eachUrl
.
toString
();
if
(
!
sUrl
.
startsWith
(
"uniboardTool://"
)
&&
!
sUrl
.
startsWith
(
"file://"
)
&&
!
sUrl
.
startsWith
(
"/"
)){
...
...
@@ -503,11 +502,10 @@ void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
}
}
bAccept
=
true
;
}
else
if
(
NULL
!=
event
->
mimeData
()
&&
event
->
mimeData
()
->
hasText
()){
}
else
if
(
NULL
!=
pMimeData
&&
pMimeData
->
hasText
()){
// The user can only drop an Url in this location so if the text is not an Url,
// we discard it.
QString
qsTxt
=
event
->
mimeData
()
->
text
().
remove
(
QRegExp
(
"[
\\
0]"
));
QString
qsTxt
=
pMimeData
->
text
().
remove
(
QRegExp
(
"[
\\
0]"
));
if
(
qsTxt
.
startsWith
(
"http"
)){
// Show the download palette if it is hidden
UBApplication
::
boardController
->
paletteManager
()
->
startDownloads
();
...
...
@@ -524,6 +522,27 @@ void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
UBDownloadManager
::
downloadManager
()
->
addFileToDownload
(
desc
);
bAccept
=
true
;
}
}
else
if
(
NULL
!=
pMimeData
&&
pMimeData
->
hasHtml
()){
QString
html
=
pMimeData
->
html
();
QString
url
=
UBApplication
::
urlFromHtml
(
html
);
if
(
""
!=
url
)
{
bAccept
=
true
;
// Show the download palette if it is hidden
UBApplication
::
boardController
->
paletteManager
()
->
startDownloads
();
// Add the dropped url to the download list
sDownloadFileDesc
desc
;
desc
.
currentSize
=
0
;
desc
.
id
=
0
;
desc
.
isBackground
=
false
;
desc
.
modal
=
false
;
desc
.
name
=
QFileInfo
(
url
).
fileName
();
desc
.
totalSize
=
0
;
desc
.
url
=
url
;
UBDownloadManager
::
downloadManager
()
->
addFileToDownload
(
desc
);
}
}
if
(
bAccept
){
event
->
accept
();
...
...
src/gui/UBLibraryWidget.cpp
View file @
e17a2fd6
...
...
@@ -385,6 +385,7 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
else
if
(
pMimeData
->
hasHtml
()){
qDebug
()
<<
"hasHtml"
;
QString
html
=
pMimeData
->
html
();
qDebug
()
<<
html
;
QString
url
=
UBApplication
::
urlFromHtml
(
html
);
if
(
""
!=
url
)
{
...
...
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