void ContactEditorMainWindow::slotQuitApp() { if (saveCurrentProject(SaveAndCloseTheme)) { writeConfig(); qApp->quit(); } }
void ContactEditorMainWindow::slotThemeSelected(const QUrl &url) { if (!saveCurrentProject(SaveAndCloseTheme)) { return; } loadTheme(url.path()); mSaveAction->setEnabled(false); }
void ContactEditorMainWindow::closeEvent(QCloseEvent *e) { if (!saveCurrentProject(SaveAndCloseTheme)) { e->ignore(); } else { writeConfig(); e->accept(); } }
/* 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); } }
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); }
/* 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); } } }
void ContactEditorMainWindow::slotNewTheme() { saveCurrentProject(SaveAndCreateNewTheme); }
void ContactEditorMainWindow::slotCloseTheme() { saveCurrentProject(SaveAndCloseTheme); }