mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-21 03:21:43 -06:00
Drag and drop feature of db file is implemented by Arvind Kumar, India
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
#include <qapplication.h>
|
||||
#include "form1.h"
|
||||
#include "extendedmainform.h"
|
||||
|
||||
#if defined(Q_WS_MAC)
|
||||
#include <Carbon/Carbon.h>
|
||||
static OSErr checkAppleEventForMissingParams(const AppleEvent& theAppleEvent)
|
||||
static OSErr checkAppleEventForMissingParams(const AppleEvent& theAppleEvent)
|
||||
{
|
||||
DescType returnedType;
|
||||
Size actualSize;
|
||||
OSErr err;
|
||||
|
||||
switch (err = AEGetAttributePtr(&theAppleEvent,
|
||||
keyMissedKeywordAttr, typeWildCard, &returnedType, nil, 0,
|
||||
|
||||
switch (err = AEGetAttributePtr(&theAppleEvent,
|
||||
keyMissedKeywordAttr, typeWildCard, &returnedType, nil, 0,
|
||||
&actualSize)) {
|
||||
case errAEDescNotFound: // If we couldnÕt find the error attribute
|
||||
return noErr; // everything is ok, return noErr
|
||||
@@ -21,34 +22,34 @@ static OSErr checkAppleEventForMissingParams(const AppleEvent& theAppleEvent)
|
||||
}
|
||||
}
|
||||
|
||||
static pascal OSErr odocHandler(const AppleEvent* inEvent, AppleEvent*
|
||||
/*reply*/, long refCon)
|
||||
static pascal OSErr odocHandler(const AppleEvent* inEvent, AppleEvent*
|
||||
/*reply*/, long refCon)
|
||||
{
|
||||
AEDescList documentList;
|
||||
OSErr err = AEGetParamDesc(inEvent, keyDirectObject, typeAEList,
|
||||
OSErr err = AEGetParamDesc(inEvent, keyDirectObject, typeAEList,
|
||||
&documentList);
|
||||
if (err == noErr) {
|
||||
err = checkAppleEventForMissingParams(*inEvent);
|
||||
|
||||
|
||||
if (err == noErr) {
|
||||
long documentCount;
|
||||
err = AECountItems(&documentList, &documentCount);
|
||||
|
||||
for (long documentIndex = 1; err == noErr && documentIndex <=
|
||||
|
||||
for (long documentIndex = 1; err == noErr && documentIndex <=
|
||||
documentCount; documentIndex++) {
|
||||
// What kind of document is it?
|
||||
DescType returnedType;
|
||||
Size actualSize;
|
||||
err = AESizeOfNthItem(&documentList, documentIndex, &returnedType,
|
||||
err = AESizeOfNthItem(&documentList, documentIndex, &returnedType,
|
||||
&actualSize);
|
||||
if (err == noErr) {
|
||||
|
||||
|
||||
// It's just a normal document file
|
||||
AEKeyword keyword;
|
||||
FSRef ref;
|
||||
err = AEGetNthPtr(&documentList, documentIndex, typeFSRef,
|
||||
err = AEGetNthPtr(&documentList, documentIndex, typeFSRef,
|
||||
&keyword, &returnedType, (Ptr)&ref, sizeof(FSRef), &actualSize);
|
||||
|
||||
|
||||
if (err == noErr) {
|
||||
char buf[1024];
|
||||
err = FSRefMakePath(&ref, reinterpret_cast<UInt8*>(buf), 1024);
|
||||
@@ -70,9 +71,10 @@ static pascal OSErr odocHandler(const AppleEvent* inEvent, AppleEvent*
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
QApplication a( argc, argv );
|
||||
mainForm w;
|
||||
mainForm w1;
|
||||
ExtendedMainForm w;
|
||||
#if defined(Q_WS_MAC)
|
||||
AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
|
||||
AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
|
||||
NewAEEventHandlerUPP(odocHandler),reinterpret_cast<long>(&w),false);
|
||||
#endif // Q_WS_MAC
|
||||
w.show();
|
||||
|
||||
@@ -5,11 +5,13 @@ LANGUAGE = C++
|
||||
|
||||
CONFIG += qt warn_on release
|
||||
|
||||
HEADERS += sqlitebrowsertypes.h \
|
||||
HEADERS += extendedmainform.h \
|
||||
sqlitebrowsertypes.h \
|
||||
sqlitedb.h \
|
||||
sqlbrowser_util.h
|
||||
|
||||
SOURCES += browsermain.cpp \
|
||||
SOURCES += extendedmainform.cpp \
|
||||
browsermain.cpp \
|
||||
sqlitedb.cpp \
|
||||
sqlbrowser_util.c
|
||||
|
||||
|
||||
Reference in New Issue
Block a user