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
4860f7d1
Commit
4860f7d1
authored
Nov 18, 2011
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented the drag and drop from a *.wgs app
parent
c508ec6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
18 deletions
+43
-18
UBBoardController.cpp
src/board/UBBoardController.cpp
+8
-1
UBLibPathViewer.cpp
src/gui/UBLibPathViewer.cpp
+35
-17
No files found.
src/board/UBBoardController.cpp
View file @
4860f7d1
...
...
@@ -1884,7 +1884,14 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
if
(
pMimeData
->
hasText
())
{
if
(
""
!=
pMimeData
->
text
()){
mActiveScene
->
addText
(
pMimeData
->
text
(),
pPos
);
// Sometimes, it is possible to have an URL as text. we check here if it is the case
QString
qsTmp
=
pMimeData
->
text
().
remove
(
QRegExp
(
"[
\\
0]"
));
if
(
qsTmp
.
startsWith
(
"http"
)){
downloadURL
(
QUrl
(
qsTmp
),
pPos
);
}
else
{
mActiveScene
->
addText
(
pMimeData
->
text
(),
pPos
);
}
}
else
{
#ifdef Q_WS_MACX
...
...
src/gui/UBLibPathViewer.cpp
View file @
4860f7d1
...
...
@@ -457,39 +457,33 @@ void UBPathScene::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
void
UBPathScene
::
dropEvent
(
QGraphicsSceneDragDropEvent
*
event
)
{
bool
bAccept
=
false
;
const
QMimeData
*
pMimeData
=
event
->
mimeData
();
if
(
NULL
!=
event
->
source
()
&&
0
==
QString
::
compare
(
event
->
source
()
->
metaObject
()
->
className
(),
"UBLibraryWidget"
))
{
if
(
NULL
!=
event
->
source
()
&&
0
==
QString
::
compare
(
event
->
source
()
->
metaObject
()
->
className
(),
"UBLibraryWidget"
)){
UBLibElement
*
pTargetElement
=
elementFromPos
(
event
->
scenePos
());
if
(
NULL
!=
pTargetElement
)
{
if
(
eUBLibElementType_Folder
==
pTargetElement
->
type
())
{
if
(
NULL
!=
pTargetElement
){
if
(
eUBLibElementType_Folder
==
pTargetElement
->
type
()){
// The drag comes from this application, we have now to get the list of UBLibElements*
QList
<
QString
>
qlDroppedElems
;
foreach
(
QUrl
url
,
pMimeData
->
urls
())
qlDroppedElems
<<
url
.
toString
();
if
(
!
qlDroppedElems
.
empty
())
{
if
(
!
qlDroppedElems
.
empty
()){
// Send a signal with the target dir and the list of ublibelement*
emit
elementsDropped
(
qlDroppedElems
,
pTargetElement
);
}
}
}
event
->
accept
()
;
bAccept
=
true
;
}
else
if
(
NULL
!=
event
->
mimeData
()
&&
event
->
mimeData
()
->
hasUrls
())
{
else
if
(
NULL
!=
event
->
mimeData
()
&&
event
->
mimeData
()
->
hasUrls
()){
QList
<
QUrl
>
urls
=
event
->
mimeData
()
->
urls
();
foreach
(
QUrl
eachUrl
,
urls
)
{
foreach
(
QUrl
eachUrl
,
urls
){
QString
sUrl
=
eachUrl
.
toString
();
if
(
!
sUrl
.
startsWith
(
"uniboardTool://"
)
&&
!
sUrl
.
startsWith
(
"file://"
)
&&
!
sUrl
.
startsWith
(
"/"
))
{
if
(
!
sUrl
.
startsWith
(
"uniboardTool://"
)
&&
!
sUrl
.
startsWith
(
"file://"
)
&&
!
sUrl
.
startsWith
(
"/"
)){
// The dropped URL comes from the web
qDebug
()
<<
"Dropped url: "
<<
sUrl
;
...
...
@@ -508,9 +502,33 @@ void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
UBDownloadManager
::
downloadManager
()
->
addFileToDownload
(
desc
);
}
}
bAccept
=
true
;
}
else
{
else
if
(
NULL
!=
event
->
mimeData
()
&&
event
->
mimeData
()
->
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]"
));
if
(
qsTxt
.
startsWith
(
"http"
)){
// 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
(
qsTxt
).
fileName
();
desc
.
totalSize
=
0
;
desc
.
url
=
qsTxt
;
UBDownloadManager
::
downloadManager
()
->
addFileToDownload
(
desc
);
bAccept
=
true
;
}
}
if
(
bAccept
){
event
->
accept
();
}
else
{
event
->
ignore
();
}
}
...
...
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