示例#1
0
void ContactEditorMainWindow::slotQuitApp()
{
    if (saveCurrentProject(SaveAndCloseTheme)) {
        writeConfig();
        qApp->quit();
    }
}
示例#2
0
void ContactEditorMainWindow::slotThemeSelected(const QUrl &url)
{
    if (!saveCurrentProject(SaveAndCloseTheme)) {
        return;
    }
    loadTheme(url.path());
    mSaveAction->setEnabled(false);
}
示例#3
0
void ContactEditorMainWindow::closeEvent(QCloseEvent *e)
{
    if (!saveCurrentProject(SaveAndCloseTheme)) {
        e->ignore();
    } else {
        writeConfig();
        e->accept();
    }
}
示例#4
0
/*
A quick checker to see if the project already exists as a file
*/
void ProjectManager::isProjectExisting()
{
	//Retrieve the current projects name
	String _currentName = projectElements->getChildByName("Settings")->getStringAttribute("Project_Name");
	
	//If the project is named "Untitled_Project" we can assume it hasn't been saved
	if (!_currentName.compare("Untitled_Project")) {
		//Proceed to save the project as a new file
		saveCurrentProjectAs();
	}
	//If the project does exist...
	else {
		//Save the current project in the same place
		saveCurrentProject(_projectFile);
	}
}
示例#5
0
void ContactEditorMainWindow::slotOpenTheme()
{
    if (!saveCurrentProject(SaveOnly)) {
        return;
    }

    const QString directory = QFileDialog::getExistingDirectory(this, i18n("Select theme directory"));
    if (directory.isEmpty()) {
        return;
    }
    closeThemeEditor();
    if (loadTheme(directory)) {
        mRecentFileAction->addUrl(QUrl::fromLocalFile(directory));
    }
    mSaveAction->setEnabled(false);
}
示例#6
0
/*
Allows the user to choose a save location then runs saveCurrentProject
*/
void ProjectManager::saveCurrentProjectAs()
{
	// Choose destination
	if (_saveChooser.browseForFileToSave(false))
	{
		//Get the file and location that the user chose
		_projectFile = _saveChooser.getResult();

		bool overwrite = true;
		//If the file exists; ask the user if they wish to overwrite it
		if (_projectFile.existsAsFile())
		{
			overwrite = AlertWindow::showOkCancelBox(
				AlertWindow::WarningIcon, "A project by this name already exists!", "Would you like to overwrite this project file?");
		}

		//If the user wishes to overwrite the file; Save
		if (overwrite == true)
		{
			saveCurrentProject(_projectFile);
		}
	}
}
示例#7
0
void ContactEditorMainWindow::slotNewTheme()
{
    saveCurrentProject(SaveAndCreateNewTheme);
}
示例#8
0
void ContactEditorMainWindow::slotCloseTheme()
{
    saveCurrentProject(SaveAndCloseTheme);
}