1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-24 12:17:26 +01:00

bug 2099700

This commit is contained in:
Vadim Kurland 2008-09-08 16:13:04 +00:00
parent c829718295
commit ec15a190a4
9 changed files with 205 additions and 41 deletions

View File

@ -1 +1 @@
#define BUILD_NUM 515
#define BUILD_NUM 516

View File

@ -1,3 +1,16 @@
2008-09-08 vadim <vadim@vk.crocodile.org>
* main_mac.cpp (odocHandler): bug #2099700 "Association of the
.fwb and .fwl file types with app on Mac". Implemented support for
the association of the application and data file type on Mac OS
X. Double-clicking on .fwb and .fwl files in Finder will now open
application and load files automatically. User can open several
files by selecting them in Finder and double-clicking.
* main.cpp (main): remove "safe mode" command line flag -s because
on Mac OS X the program is started with flag -psn when it is
launched via finder. This caused undesired effects.
2008-09-06 Vadim Kurland <vadim@vk.crocodile.org>
* FWWindow.cpp (FWWindow::projectWindowClosed): fixed bug
@ -17,9 +30,9 @@
choose file name, internal RCS object used to be deleted anyway.
* v3.0.1 started
* v3.0.0 released Sep 1, 2008. Merged branch "v3" r512 to trunk
2008-09-01 Vadim Kurland <vadim@vk.crocodile.org>
* res.pro: Do not try to install icons if variable ICONSDIR was

View File

@ -11,15 +11,15 @@ SO_VERSION = @LIBFWBUILDER_SOLIB_VERSION@
DEFINES += $$(DEFINES)
LANGUAGE = C++
UI_DIR = ui
MANDIR = /home/vadim/src/fwb3-branch-v3/install_root/share/man/
DOCDIR = /home/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.1
MANDIR = /Users/vadim/src/fwb3-branch-v3/install_root/share/man/
DOCDIR = /Users/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.1
HAVE_ANTLR_RUNTIME = 1
HAVE_EXTERNAL_ANTLR = 0
unix {
ANTLR_INCLUDEPATH = /home/vadim/src/fwb3-branch-v3/source/fwbuilder/src/
ANTLR_LIBS = /home/vadim/src/fwb3-branch-v3/source/fwbuilder/src/antlr/libantlr.a
ANTLR_INCLUDEPATH = /Users/vadim/src/fwb3-branch-v3/source/fwbuilder/src/
ANTLR_LIBS = /Users/vadim/src/fwb3-branch-v3/source/fwbuilder/src/antlr/libantlr.a
FWBPARSER_LIB = ../parsers/libfwbparser.a
}
@ -30,38 +30,38 @@ unix {
MOC_DIR = .moc
OBJECTS_DIR = .obj
PREFIX = /home/vadim/src/fwb3-branch-v3/install_root
PREFIX = /Users/vadim/src/fwb3-branch-v3/install_root
exec_prefix = @EXEC_PREFIX@
DESTDIR =
ICONSDIR = /home/vadim/src/fwb3-branch-v3/install_root/share//icons/hicolor/
ICONSDIR =
INCLUDEPATH += .. ../.. $$(INCLUDEPATH) /home/vadim/src/fwb3-branch-v3/install_root/include/ /home/vadim/src/fwb3-branch-v3/install_root/include/fwb-3 /usr/include/libxml2
INCLUDEPATH += .. ../.. $$(INCLUDEPATH) /Users/vadim/src/fwb3-branch-v3/install_root/include/ /Users/vadim/src/fwb3-branch-v3/install_root/include/fwb-3 /usr/include/libxml2
LIBS_FWCOMPILER = -L/home/vadim/src/fwb3-branch-v3/install_root/lib -pthread -lfwcompiler -lfwbuilder -lxslt -lxml2 -lnetsnmp -lm -lwrap
LIBS_FWBUILDER = -L/home/vadim/src/fwb3-branch-v3/install_root/lib -pthread -lfwbuilder -lxslt -lxml2 -lnetsnmp -lm -lwrap
LIBS_FWCOMPILER = -L/Users/vadim/src/fwb3-branch-v3/install_root/lib -lfwcompiler -lfwbuilder -lxslt -lxml2 -lz -lpthread -licucore -lm -lnetsnmp
LIBS_FWBUILDER = -L/Users/vadim/src/fwb3-branch-v3/install_root/lib -lfwbuilder -lxslt -lxml2 -lz -lpthread -licucore -lm -lnetsnmp
target.path = $$PREFIX/bin
dtd.path = @TEMPLATE_DIR@/
migration.path = @TEMPLATE_DIR@/migration
doc.path = /home/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.1
datadir.path = /home/vadim/src/fwb3-branch-v3/install_root/share/
doc.path = /Users/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.1
datadir.path = /Users/vadim/src/fwb3-branch-v3/install_root/share/
# win32:target.path = $$PREFIX/
# unix:target.path = $$PREFIX/share/fwbuilder/
# macx:target.path = $$PREFIX/
res.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.1
res_os.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.1/os/
res_platform.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.1/platform/
res_help.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.1/help/
res_desktop.path = /home/vadim/src/fwb3-branch-v3/install_root/share//applications/
res.path = ../Resources
res_os.path = ../Resources/os/
res_platform.path = ../Resources/platform/
res_help.path = ../Resources/help/
res_desktop.path = /Users/vadim/src/fwb3-branch-v3/install_root/share//applications/
INSTALLS += res
INSTALLS += res_os
INSTALLS += res_platform
# INSTALLS += icns
LIBS += $$LIBS_FWBUILDER -lutil
LIBS += $$LIBS_FWBUILDER -L/sw/lib -lpoll
PKGLOCALEDIR = $$res.path/locale

View File

@ -282,7 +282,6 @@ void FWWindow::startupLoad()
current_version_http_getter->get(QUrl(CHECK_UPDATE_URL));
}
if (activeProject())
{
activeProject()->startupLoad();
@ -366,6 +365,19 @@ void FWWindow::fileOpen()
recreateWindowsMenu();
}
void FWWindow::loadFile(const QString &filename)
{
std::auto_ptr<ProjectPanel> proj(newProjectPanel());
if (proj->loadFile(filename))
{
showSub(proj.get());
proj->readyStatus(true);
proj->loadState();
proj.release();
}
recreateWindowsMenu();
}
void FWWindow::fileClose()
{
if (fwbdebug) qDebug("FWWindow::fileClose()");

View File

@ -186,6 +186,7 @@ public slots:
void load(QWidget *dialogs_parent,RCS *rcs);
void load(QWidget *dialogs_parent);
void loadLibrary(const std::string &libfpath);
void loadFile(const QString &filename);
void save();
bool checkin(bool unlock);
int findFirewallInList(libfwbuilder::FWObject *f);

View File

@ -340,16 +340,23 @@ public:
bool editingLibrary();
void createRCS( const QString &filename);
void load(QWidget *dialogs_parent,RCS *rcs);
void load(QWidget *dialogs_parent,RCS *rcs,libfwbuilder::FWObjectDatabase * clone);
void load(QWidget *dialogs_parent,RCS *rcs,
libfwbuilder::FWObjectDatabase * clone);
void load(QWidget *dialogs_parent);
bool loadFile(const QString &fileName);
void save();
void saveState();
void loadState();
bool checkin(bool unlock);
void loadLibrary(const std::string &libfpath);
bool exportLibraryTest(std::list<libfwbuilder::FWObject*> &selectedLibs);
void exportLibraryTo(QString fname,std::list<libfwbuilder::FWObject*> &selectedLibs, bool rof);
void exportLibraryTo(QString fname,
std::list<libfwbuilder::FWObject*> &selectedLibs,
bool rof);
void findExternalRefs(libfwbuilder::FWObject *lib,
libfwbuilder::FWObject *root,
@ -389,8 +396,6 @@ protected:
virtual void closeEvent( QCloseEvent * );
virtual void resizeEvent ( QResizeEvent * event );
bool loadFile(const QString &fileName);
void setMainSplitterPosition(int w1, int w2);
void setObjInfoSplitterPosition(int w1, int w2);
};

View File

@ -139,6 +139,7 @@ SOURCES += ProjectPanel.cpp \
ProjectPanel_state_ops.cpp \
FWWindow.cpp \
main.cpp \
main_mac.cpp \
utils.cpp \
utils_no_qt.cpp \
Importer.cpp \

View File

@ -67,11 +67,11 @@
#include "listOfLibraries.h"
#include "ObjectEditor.h"
#include "findDialog.h"
#include "ProjectPanel.h"
#include "fwbuilder/FWObject.h"
#include "fwbuilder/Tools.h"
#include "fwbuilder/dns.h"
//#include "fwbuilder/crypto.h"
#include "fwbuilder/XMLTools.h"
#include "fwbuilder/Resources.h"
#include "fwbuilder/FWException.h"
@ -121,6 +121,11 @@ extern bool init2(const std::string &a1,
bool f1, bool f2, bool d);
#endif
#if defined(Q_WS_MAC)
extern void connectOdocHandler();
#endif
using namespace libfwbuilder;
using namespace std;
@ -138,7 +143,6 @@ bool cli_print = false;
QString cli_print_fwname = "";
#ifndef _WIN32
#ifndef HAVE_CFMAKERAW
static inline void cfmakeraw(struct termios *termios_p)
{
@ -332,7 +336,6 @@ void usage()
cerr << endl;
}
int main( int argc, char *argv[] )
{
@ -556,7 +559,7 @@ int main( int argc, char *argv[] )
// started via Finder.
int c;
while ((c = getopt (argc , argv , "hvf:o:P:dxsg")) != EOF )
while ((c = getopt (argc , argv , "hvf:o:P:dxg")) != EOF )
switch (c) {
case 'h':
usage();
@ -578,13 +581,10 @@ int main( int argc, char *argv[] )
cout << VERSION << endl;
exit(0);
case 's':
safemode = true;
break;
case 'g':
gui_experiment1 = true;
break;
case 'P':
cli_print = true ;
cli_print_fwname = optarg;
@ -682,11 +682,13 @@ int main( int argc, char *argv[] )
if (fwbdebug) qDebug("loading libraries ...");
mw = new FWWindow();
mw->setSafeMode(safemode);
//mw->setSafeMode(safemode);
if (filename!="")
{
QDir file (filename);
mw->setStartupFileName(file.canonicalPath ());
if (fwbdebug)
qDebug("Open file %s", filename.toAscii().constData());
QDir file(filename);
mw->setStartupFileName(file.canonicalPath());
}
//QToolTip::setWakeUpDelay( st->getTooltipDelay()*1000 );
@ -694,12 +696,12 @@ int main( int argc, char *argv[] )
app->connect(app, SIGNAL( lastWindowClosed() ), app, SLOT( quit()));
#if defined(Q_WS_MAC)
connectOdocHandler();
#endif
if (fwbdebug) qDebug("Checking for new version ...");
// setup single shot timer to call loadEverything()
QTimer::singleShot( 0, mw, SLOT(startupLoad()) );
// setup single shot timer to call loadEverything()
QTimer::singleShot(0, mw, SLOT(startupLoad()));
app->exec();
@ -732,3 +734,5 @@ int main( int argc, char *argv[] )
qDebug("Exception: %s",ex.toString().c_str());
}
}

128
src/gui/main_mac.cpp Normal file
View File

@ -0,0 +1,128 @@
/*
Firewall Builder
Copyright (C) 2008 NetCitadel, LLC
Author: Vadim Kurland vadim@fwbuilder.org
$Id: main.cpp 493 2008-08-30 05:05:56Z vadim $
This program is free software which we release under the GNU General Public
License. You may redistribute and/or modify this program under the terms
of that license as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To get a copy of the GNU General Public License, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../../config.h"
#include "global.h"
#include "VERSION.h"
#include <QDir>
#include <QString>
#include "FWWindow.h"
using namespace std;
#if defined(Q_WS_MAC)
#include <Carbon/Carbon.h>
static OSErr checkAppleEventForMissingParams(const AppleEvent&
theAppleEvent)
{
DescType returnedType;
Size actualSize;
OSErr err;
switch (err = AEGetAttributePtr(&theAppleEvent,
keyMissedKeywordAttr,
typeWildCard,
&returnedType,
nil,
0,
&actualSize))
{
case errAEDescNotFound:
return noErr;
case noErr:
return errAEEventNotHandled;
default:
return err;
}
}
static pascal OSErr odocHandler(const AppleEvent* inEvent, AppleEvent*
/*reply*/, long /*refCon*/)
{
if (fwbdebug) qDebug("Handling 'odoc'\n");
AEDescList documentList;
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 <=
documentCount; documentIndex++)
{
// What kind of document is it?
DescType returnedType;
Size actualSize;
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,
&keyword,
&returnedType,
(Ptr)&ref, sizeof(FSRef), &actualSize);
if (err == noErr)
{
char buf[1024];
FSRefMakePath(&ref, reinterpret_cast<UInt8*>(buf),1024);
QDir file(buf);
mw->loadFile(file.canonicalPath());
}
}
}
}
AEDisposeDesc(&documentList);
}
if (fwbdebug) qDebug("Returning %d from handleOpenDocuments\n", err);
return err;
}
void connectOdocHandler()
{
AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
NewAEEventHandlerUPP(odocHandler),0,false);
}
#endif // Q_WS_MAC