Пример #1
0
void SessionManager::saveSession() {
	if(_currentSession.isEmpty()){
		saveSessionAs();
	}else{
		save();
		emit statusMessage(tr("Save session ") + _currentSession);
	}
}
Пример #2
0
void SessionManager::renameSession( const QString & oldName, const QString & newName )
{
    if (mCurrentSession && mCurrentSession->name() == oldName) {
        saveSessionAs(newName);
        removeSession(oldName);
    } else {
        QDir dir = sessionsDir();
        if (dir.path().isEmpty())
            return;

        if (!dir.rename(oldName + ".yaml", newName + ".yaml"))
            qWarning("Could not rename session file!");
    }
}
Пример #3
0
void MainWindow::initMenuFile() {
	//connect menu "File" Action
	connect(actionNew, SIGNAL(triggered()), _documentManager, SLOT(newDocument()));
	connect(actionOpen, SIGNAL(triggered()), _documentManager, SLOT(open()));
	connect(actionSave, SIGNAL(triggered()), _documentManager, SLOT(save()));
	connect(actionSaveAs, SIGNAL(triggered()), _documentManager, SLOT(saveAs()));
	connect(actionSaveACopyAs, SIGNAL(triggered()), _documentManager, SLOT(saveACopyAs()));
	connect(actionSaveAll, SIGNAL(triggered()), _documentManager, SLOT(saveAll()));
	connect(actionClose, SIGNAL(triggered()), _documentManager, SLOT(close()));
	connect(actionCloseAll, SIGNAL(triggered()), _documentManager, SLOT(closeAll()));
	connect(actionCloseAllExceptCurrentDocument, SIGNAL(triggered()), _documentManager, SLOT(closeAllExceptCurrentDocument()));
	connect(actionReload, SIGNAL(triggered()), _documentManager, SLOT(reload()));
	connect(actionPrint, SIGNAL(triggered()), _documentManager, SLOT(print()));
	connect(actionExit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));

	connect(actionExportAsHTML, SIGNAL(triggered()), this, SLOT(exportDocument()));

	connect(actionNewSession, SIGNAL(triggered()), _sessionManager, SLOT(newSession()));
	connect(actionOpenSession, SIGNAL(triggered()), _sessionManager, SLOT(openSession()));
	connect(actionSwitchSession, SIGNAL(triggered()), _sessionManager, SLOT(switchSession()));
	connect(actionSaveSession, SIGNAL(triggered()), _sessionManager, SLOT(saveSession()));
	connect(actionSaveSessionAs, SIGNAL(triggered()), _sessionManager, SLOT(saveSessionAs()));
	connect(actionManageSessions, SIGNAL(triggered()), _sessionManager, SLOT(manageSessions()));

	//recent file actions
	connect(actionEmptyRecentFilesList, SIGNAL(triggered()), this, SLOT(clearRecentFile()));
	connect(actionOpenAllRecentFiles, SIGNAL(triggered()), this, SLOT(openAllRecentFile()));
	_recentFileSeparator = menuRecentFiles->addSeparator();
	for (int i = 0; i < MaxRecentFiles; ++i) {
		_recentFileActions[i] = new QAction(this);
		_recentFileActions[i]->setVisible(false);
		connect(_recentFileActions[i], SIGNAL(triggered()),this, SLOT(openRecentFile()));
		menuRecentFiles->addAction(_recentFileActions[i]);
	}
	updateRecentFileActions();
}