Esempio n. 1
0
bool PhDocumentWindow::openDocument(const QString &fileName)
{
	if(fileName != _settings->currentDocument())
		resetDocument();

	if(_watcher.addPath(fileName))
		PHDEBUG << "now watching " << fileName;
	_settings->setCurrentDocument(fileName);
	if(!fileName.isEmpty())
		_settings->setLastDocumentFolder(QFileInfo(fileName).absolutePath());
	this->setWindowTitle(fileName);

	QStringList recentDocList = _settings->recentDocumentList();
	recentDocList.removeAll(fileName);
	recentDocList.insert(0, fileName);
	while(recentDocList.size() > _settings->maxRecentDocument())
		recentDocList.removeLast();

	_settings->setRecentDocumentList(recentDocList);

	updateRecentDocumentMenu();

	addFilePermission(fileName);

	return true;
}
Esempio n. 2
0
void PhDocumentWindow::processArg(int argc, char *argv[])
{
#warning /// @todo move to PhApplication
	for(int i = 1; i < argc; i++) {
		if(QFile::exists(argv[i]))
			_settings->setCurrentDocument(argv[i]);
	}
	if(QFile::exists(_settings->currentDocument()))
		openDocument(_settings->currentDocument());
	else
		updateRecentDocumentMenu();
}
Esempio n. 3
0
void PhDocumentWindow::processArg(int argc, char *argv[])
{
#warning /// @todo move to PhApplication
	for(int i = 1; i < argc; i++) {
		if(QFile::exists(argv[i])) {
			PHDEBUG << "Using document from the command line:" << argv[i];
			_settings->setCurrentDocument(argv[i]);
		}
	}
	if(QFile::exists(_settings->currentDocument())) {
		QString fileName = _settings->currentDocument();
		PHDEBUG << "Opening last document:" << fileName;
		checkFilePermission(fileName);
		openDocument(fileName);
	}
	else
		updateRecentDocumentMenu();

	// This is for the drag and drop feature
	setAcceptDrops(true);
}