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
483520cf
Commit
483520cf
authored
Dec 09, 2011
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some drag and drop issues on windows
parent
74162faf
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
33 deletions
+24
-33
UBApplication.cpp
src/core/UBApplication.cpp
+9
-5
UBLibPathViewer.cpp
src/gui/UBLibPathViewer.cpp
+6
-7
UBLibPathViewer.h
src/gui/UBLibPathViewer.h
+1
-0
UBLibraryWidget.cpp
src/gui/UBLibraryWidget.cpp
+8
-21
No files found.
src/core/UBApplication.cpp
View file @
483520cf
...
...
@@ -643,9 +643,14 @@ QString UBApplication::globalStyleSheet()
QString
UBApplication
::
urlFromHtml
(
QString
html
)
{
QString
_html
;
QRegExp
comments
(
"
\\
<![
\r\n\t
]*(--([^
\\
-]|[
\r\n
]|-[^
\\
-])*--[
\r\n\t
]*)
\\
>"
);
QString
url
;
QDomDocument
domDoc
;
domDoc
.
setContent
(
html
.
remove
(
QRegExp
(
"[
\\
0]"
)));
// We remove all the comments & CRLF of this html
_html
=
html
.
remove
(
comments
);
domDoc
.
setContent
(
_html
.
remove
(
QRegExp
(
"[
\\
0]"
)));
QDomElement
rootElem
=
domDoc
.
documentElement
();
// QUICKFIX: Here we have to check rootElem. Sometimes it can be a <meta> tag
...
...
@@ -658,7 +663,6 @@ QString UBApplication::urlFromHtml(QString html)
url
=
rootElem
.
attribute
(
"src"
);
}
qDebug
()
<<
"The URL is: "
<<
url
;
return
url
;
}
...
...
src/gui/UBLibPathViewer.cpp
View file @
483520cf
...
...
@@ -484,8 +484,6 @@ void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
QString
sUrl
=
eachUrl
.
toString
();
if
(
!
sUrl
.
startsWith
(
"uniboardTool://"
)
&&
!
sUrl
.
startsWith
(
"file://"
)
&&
!
sUrl
.
startsWith
(
"/"
)){
// The dropped URL comes from the web
qDebug
()
<<
"Dropped url: "
<<
sUrl
;
// Show the download palette if it is hidden
UBApplication
::
boardController
->
paletteManager
()
->
startDownloads
();
...
...
@@ -499,10 +497,11 @@ void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
desc
.
totalSize
=
0
;
desc
.
url
=
sUrl
;
UBDownloadManager
::
downloadManager
()
->
addFileToDownload
(
desc
);
bAccept
=
true
;
}
}
bAccept
=
true
;
}
else
if
(
NULL
!=
pMimeData
&&
pMimeData
->
hasText
()){
}
if
(
!
bAccept
&&
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
=
pMimeData
->
text
().
remove
(
QRegExp
(
"[
\\
0]"
));
...
...
@@ -522,13 +521,12 @@ void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
UBDownloadManager
::
downloadManager
()
->
addFileToDownload
(
desc
);
bAccept
=
true
;
}
}
else
if
(
NULL
!=
pMimeData
&&
pMimeData
->
hasHtml
()){
}
if
(
!
bAccept
&&
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
();
...
...
@@ -542,6 +540,7 @@ void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
desc
.
totalSize
=
0
;
desc
.
url
=
url
;
UBDownloadManager
::
downloadManager
()
->
addFileToDownload
(
desc
);
bAccept
=
true
;
}
}
if
(
bAccept
){
...
...
src/gui/UBLibPathViewer.h
View file @
483520cf
...
...
@@ -70,6 +70,7 @@ private:
QTime
mClickTime
;
/** A map between a widget and a chained element */
QMap
<
QGraphicsWidget
*
,
UBChainedLibElement
*>
mMapWidgetToChainedElem
;
};
class
UBLibPathViewer
:
public
QGraphicsView
...
...
src/gui/UBLibraryWidget.cpp
View file @
483520cf
...
...
@@ -330,21 +330,17 @@ void UBLibraryWidget::onDropMe(const QMimeData *_data)
void
UBLibraryWidget
::
dropEvent
(
QDropEvent
*
event
)
{
const
QMimeData
*
pMimeData
=
event
->
mimeData
();
if
(
event
->
source
()
==
this
)
{
if
(
event
->
source
()
==
this
){
event
->
accept
();
// Get the destination item
UBLibElement
*
pElem
=
elementAt
(
event
->
pos
());
if
(
NULL
!=
pElem
)
{
if
(
eUBLibElementType_Folder
==
pElem
->
type
())
{
if
(
NULL
!=
pElem
){
if
(
eUBLibElementType_Folder
==
pElem
->
type
()){
// The drag comes from this application, we have now to get the list of UBLibElements*
QList
<
QString
>
qlDroppedElems
;
foreach
(
QUrl
url
,
pMimeData
->
urls
())
{
foreach
(
QUrl
url
,
pMimeData
->
urls
()){
qlDroppedElems
<<
url
.
toString
();
}
...
...
@@ -360,7 +356,6 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
// and if we want to display the download widget in order to make the user wait for the end of the download, we need
// to check the URLs first!
if
(
pMimeData
->
hasUrls
()){
qDebug
()
<<
"hasUrls"
;
QList
<
QUrl
>
urlList
=
pMimeData
->
urls
();
for
(
int
i
=
0
;
i
<
urlList
.
size
()
&&
i
<
32
;
++
i
){
QString
filePath
;
...
...
@@ -382,20 +377,16 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
// When an HTML is present, it means that we dropped something from the web. Normally, the HTML contains the element
// of the webpage and has a 'src' attribute containing the URL of the web ressource. Here we are looking for this
// 'src' attribute, get its value and download the ressource from this URL.
else
if
(
pMimeData
->
hasHtml
()){
qDebug
()
<<
"hasHtml"
;
if
(
!
bDropAccepted
&&
pMimeData
->
hasHtml
()){
QString
html
=
pMimeData
->
html
();
qDebug
()
<<
html
;
QString
url
=
UBApplication
::
urlFromHtml
(
html
);
if
(
""
!=
url
)
{
if
(
""
!=
url
){
mLibraryController
->
importItemOnLibrary
(
url
);
bDropAccepted
=
true
;
}
}
else
if
(
pMimeData
->
hasText
()){
if
(
!
bDropAccepted
&&
pMimeData
->
hasText
()){
// On linux external dragged element are considered as text;
qDebug
()
<<
"hasText: "
<<
pMimeData
->
text
();
QString
filePath
=
QUrl
(
pMimeData
->
text
()).
toLocalFile
();
if
(
""
!=
filePath
){
mLibraryController
->
importItemOnLibrary
(
filePath
);
...
...
@@ -415,15 +406,11 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
#endif
}
}
else
if
(
pMimeData
->
hasImage
()){
qDebug
()
<<
"hasImage"
;
if
(
!
bDropAccepted
&&
pMimeData
->
hasImage
()){
QImage
image
=
qvariant_cast
<
QImage
>
(
pMimeData
->
imageData
());
mLibraryController
->
importImageOnLibrary
(
image
);
bDropAccepted
=
true
;
}
else
{
qWarning
()
<<
"Cannot import data"
;
}
if
(
bDropAccepted
){
onRefreshCurrentFolder
();
...
...
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