Drag and drop feature of db file is implemented by Arvind Kumar, India

This commit is contained in:
arvind_your
2009-07-03 12:22:55 +00:00
parent eb48435c28
commit 2fe9e1c7f3
2 changed files with 22 additions and 18 deletions

View File

@@ -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();

View File

@@ -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