mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
* LyX::addFileToLoad(): new method for double-clicked file icons on MacOS.
* GuiApplication::event(): special case for FileOpen events: memorize the filenames if LyX is not properly started yet. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18201 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3fcd616b19
commit
1becd845c1
12
src/LyX.cpp
12
src/LyX.cpp
@ -62,6 +62,7 @@
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <csignal>
|
||||
#include <map>
|
||||
@ -552,6 +553,17 @@ int LyX::init(int & argc, char * argv[])
|
||||
}
|
||||
|
||||
|
||||
void LyX::addFileToLoad(FileName const & fname)
|
||||
{
|
||||
vector<FileName>::const_iterator cit = std::find(
|
||||
pimpl_->files_to_load_.begin(), pimpl_->files_to_load_.end(),
|
||||
fname);
|
||||
|
||||
if (cit == pimpl_->files_to_load_.end())
|
||||
pimpl_->files_to_load_.push_back(fname);
|
||||
}
|
||||
|
||||
|
||||
void LyX::loadFiles()
|
||||
{
|
||||
vector<FileName>::const_iterator it = pimpl_->files_to_load_.begin();
|
||||
|
@ -21,6 +21,10 @@
|
||||
|
||||
namespace lyx {
|
||||
|
||||
namespace support {
|
||||
class FileName;
|
||||
}
|
||||
|
||||
class Buffer;
|
||||
class BufferList;
|
||||
class Converters;
|
||||
@ -102,6 +106,9 @@ public:
|
||||
/// Execute batch commands if available.
|
||||
void execBatchCommands();
|
||||
|
||||
///
|
||||
void addFileToLoad(support::FileName const &);
|
||||
|
||||
private:
|
||||
/// Do some cleanup in preparation of an exit.
|
||||
void prepareExit();
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "graphics/LoaderQueue.h"
|
||||
|
||||
#include "support/FileName.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/os.h"
|
||||
#include "support/Package.h"
|
||||
@ -75,6 +76,8 @@ int getDPI()
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using support::FileName;
|
||||
|
||||
frontend::Application * createApplication(int & argc, char * argv[])
|
||||
{
|
||||
return new frontend::GuiApplication(argc, argv);
|
||||
@ -207,8 +210,18 @@ bool GuiApplication::event(QEvent * e)
|
||||
case QEvent::FileOpen: {
|
||||
// Open a file; this happens only on Mac OS X for now
|
||||
QFileOpenEvent * foe = static_cast<QFileOpenEvent *>(e);
|
||||
lyx::dispatch(FuncRequest(LFUN_FILE_OPEN,
|
||||
fromqstr(foe->file())));
|
||||
|
||||
if (!currentView() || !currentView()->view())
|
||||
// The application is not properly initialized yet.
|
||||
// So we acknowledge the event and delay the file opening
|
||||
// until LyX is ready.
|
||||
// FIXME UNICODE: FileName accept an utf8 encoded string.
|
||||
LyX::ref().addFileToLoad(FileName(fromqstr(foe->file())));
|
||||
else
|
||||
lyx::dispatch(FuncRequest(LFUN_FILE_OPEN,
|
||||
qstring_to_ucs4(foe->file())));
|
||||
|
||||
e->accept();
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user