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
76a66d02
Commit
76a66d02
authored
Nov 14, 2011
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drag and drop support from Safari done
parent
6e80911b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
169 additions
and
122 deletions
+169
-122
UBBoardController.cpp
src/board/UBBoardController.cpp
+13
-0
UBPlatformUtils.h
src/frameworks/UBPlatformUtils.h
+108
-121
UBPlatformUtils_linux.cpp
src/frameworks/UBPlatformUtils_linux.cpp
+9
-0
UBPlatformUtils_mac.mm
src/frameworks/UBPlatformUtils_mac.mm
+16
-0
UBPlatformUtils_win.cpp
src/frameworks/UBPlatformUtils_win.cpp
+8
-1
UBLibraryWidget.cpp
src/gui/UBLibraryWidget.cpp
+14
-0
UBLibraryWidget.h
src/gui/UBLibraryWidget.h
+1
-0
No files found.
src/board/UBBoardController.cpp
View file @
76a66d02
...
...
@@ -1886,6 +1886,19 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
if
(
""
!=
pMimeData
->
text
()){
mActiveScene
->
addText
(
pMimeData
->
text
(),
pPos
);
}
else
{
#ifdef Q_WS_MACX
// With Safari, in 95% of the drops, the mime datas are hidden in Apple Web Archive pasteboard type.
// This is due to the way Safari is working so we have to dig into the pasteboard in order to retrieve
// the data.
QString
qsUrl
=
UBPlatformUtils
::
urlFromClipboard
();
if
(
""
!=
qsUrl
){
// We finally got the url of the dropped ressource! Let's import it!
downloadURL
(
qsUrl
,
pPos
);
return
;
}
#endif
}
}
}
...
...
src/frameworks/UBPlatformUtils.h
View file @
76a66d02
...
...
@@ -98,36 +98,23 @@ class UBPlatformUtils
public
:
static
void
init
();
static
void
destroy
();
static
QString
applicationResourcesDirectory
();
static
void
hideFile
(
const
QString
&
filePath
);
static
void
setFileType
(
const
QString
&
filePath
,
unsigned
long
fileType
);
static
void
fadeDisplayOut
();
static
void
fadeDisplayIn
();
static
QString
preferredTranslation
();
static
QString
preferredLanguage
();
static
bool
hasVirtualKeyboard
();
//static void showVirtualKeyboard();
static
void
runInstaller
(
const
QString
&
installerFilePath
);
static
void
bringPreviousProcessToFront
();
static
QString
osUserLoginName
();
static
void
setDesktopMode
(
bool
desktop
);
static
void
setWindowNonActivableFlag
(
QWidget
*
widget
,
bool
nonAcivable
);
static
QString
computerName
();
static
UBKeyboardLocale
**
getKeyboardLayouts
(
int
&
nCount
);
static
QString
urlFromClipboard
();
};
...
...
src/frameworks/UBPlatformUtils_linux.cpp
View file @
76a66d02
...
...
@@ -331,3 +331,12 @@ void UBPlatformUtils::destroyKeyboardLayouts()
delete
[]
keyboardLayouts
;
keyboardLayouts
=
NULL
;
}
QString
UBPlatformUtils
::
urlFromClipboard
()
{
QString
qsRet
;
// Not used on Linux
return
qsRet
;
}
src/frameworks/UBPlatformUtils_mac.mm
View file @
76a66d02
...
...
@@ -12,6 +12,8 @@
#import <Foundation/NSAutoreleasePool.h>
#import <Carbon/Carbon.h>
#import <APELite.h>
#import <WebKit/WebKit.h>
#import <AppKit/AppKit.h>
NSString* bundleShortVersion(NSBundle *bundle)
...
...
@@ -537,3 +539,17 @@ void UBPlatformUtils::initializeKeyboardLayouts()
void UBPlatformUtils::destroyKeyboardLayouts()
{}
QString UBPlatformUtils::urlFromClipboard()
{
QString qsRet;
NSPasteboard* pPasteboard = [NSPasteboard pasteboardWithName:@"Apple CFPasteboard drag"];
WebArchive* pArchive = [[WebArchive alloc] initWithData:[pPasteboard dataForType:@"com.apple.webarchive"]];
qsRet = [[[[pArchive mainResource] URL] absoluteString] UTF8String];
[pArchive release];
return qsRet;
}
src/frameworks/UBPlatformUtils_win.cpp
View file @
76a66d02
...
...
@@ -368,3 +368,10 @@ void UBPlatformUtils::destroyKeyboardLayouts()
delete
[]
keyboardLayouts
;
keyboardLayouts
=
NULL
;
}
QString
UBPlatformUtils
::
urlFromClipboard
()
{
QString
qsRet
;
// Not implemented yet
return
qsRet
;
}
src/gui/UBLibraryWidget.cpp
View file @
76a66d02
...
...
@@ -27,6 +27,7 @@
#include "core/UBDownloadManager.h"
#include "frameworks/UBFileSystemUtils.h"
#include "frameworks/UBPlatformUtils.h"
#include "core/memcheck.h"
...
...
@@ -389,6 +390,19 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
mLibraryController
->
importItemOnLibrary
(
filePath
);
bDropAccepted
=
true
;
}
else
{
#ifdef Q_WS_MACX
// With Safari, in 95% of the drops, the mime datas are hidden in Apple Web Archive pasteboard type.
// This is due to the way Safari is working so we have to dig into the pasteboard in order to retrieve
// the data.
QString
qsUrl
=
UBPlatformUtils
::
urlFromClipboard
();
if
(
""
!=
qsUrl
){
// We finally got the url of the dropped ressource! Let's import it!
mLibraryController
->
importItemOnLibrary
(
qsUrl
);
bDropAccepted
=
true
;
}
#endif
}
}
else
if
(
pMimeData
->
hasImage
()){
qDebug
()
<<
"hasImage"
;
...
...
src/gui/UBLibraryWidget.h
View file @
76a66d02
...
...
@@ -79,6 +79,7 @@ private:
void
refreshView
();
void
generateItems
();
void
appendChainedElement
(
UBChainedLibElement
*
element
,
UBChainedLibElement
*
toElem
);
UBLibElement
*
elementAt
(
QPoint
p
);
UBLibElement
*
elementFromFilePath
(
const
QString
&
filePath
);
UBLibraryController
*
mLibraryController
;
...
...
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