Example #1
0
bool DocumentEditor::saveWithCharset(const QString& codec_) {
	_codec = codec_;
	if (_fullPath.isEmpty()) {
		return saveAs();
	} else {
		return saveFile(_fullPath);
	}
}
Example #2
0
void MainWindow::initActionsConnections()
{
    connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));
    connect(ui->actionSaveAs, SIGNAL(triggered()), this, SLOT(saveAs()));
    connect(ui->actionCopy, SIGNAL(triggered()), this, SLOT(copy()));
    connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(help()));
}
bool MyChild::save()
{
    if (isUntitled) {
        return saveAs();
    } else {
        return saveFile(curFile);
    }
}
bool MainWindow::save()
{
    if (curFile.isEmpty()) {
        return saveAs();
    } else {
        return saveFile(curFile);
    }
}
Example #5
0
bool TextEditor::save()
{
    if (curFile.isEmpty()) {
        return saveAs();
    } else {
        return saveFile(curFile);
    }
}
Example #6
0
bool MainWindowImpl::save()
{
    if (currentDocument.isEmpty()) {
        return saveAs();
    } else {
        return saveFile(currentDocument);
    }
}
Example #7
0
void MQLEdit::fileSave()
{
    if(_fileName.isEmpty()) {
	saveAs();
    } else {
	save();
    }
}
Example #8
0
bool SyntaxTextEditor::save()
{
    if (isUntitled) {
        return saveAs();
    } else {
        return saveFile(curFile);
    }
}
Example #9
0
// Methods
void MainWindow::createActions()
{
    // File actions
    newAction = new QAction(tr("&New"), this);
    newAction->setIcon(QIcon::fromTheme("document-new"));
    newAction->setShortcut(QKeySequence::New);
    newAction->setStatusTip(tr("Create a new spreadsheet"));
    connect(newAction, SIGNAL(triggered()), this, SLOT(newFile()));

    openAction = new QAction(tr("&Open"), this);
    openAction->setIcon(QIcon::fromTheme("document-open"));
    openAction->setShortcut(QKeySequence::Open);
    openAction->setStatusTip(tr("Open a spreadsheet"));
    connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));

    saveAction = new QAction(tr("&Save"), this);
    saveAction->setIcon(QIcon::fromTheme("document-save"));
    saveAction->setShortcut(QKeySequence::Save);
    saveAction->setStatusTip(tr("Save a spreadsheet"));
    connect(saveAction, SIGNAL(triggered()), this, SLOT(save()));

    saveAsAction = new QAction(tr("Save &As"), this);
    saveAsAction->setIcon(QIcon::fromTheme("document-save-as"));
    saveAsAction->setShortcut(QKeySequence::SaveAs);
    saveAsAction->setStatusTip(tr("Save a spreadsheet in new file"));
    connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()));

    exitAction = new QAction(tr("&Exit"), this);
    exitAction->setIcon(QIcon::fromTheme("application-exit"));
    exitAction->setShortcut(QKeySequence::Quit);
    connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));

    // Edit actions
    cutAction = new QAction(tr("&Cut"), this);
    cutAction->setIcon(QIcon::fromTheme("edit-cut"));
    cutAction->setShortcut(QKeySequence::Cut);

    copyAction = new QAction(tr("&Copy"), this);
    copyAction->setIcon(QIcon::fromTheme("edit-copy"));
    copyAction->setShortcut(QKeySequence::Copy);

    pasteAction = new QAction(tr("&Paste"), this);
    pasteAction->setIcon(QIcon::fromTheme("edit-paste"));
    pasteAction->setShortcut(QKeySequence::Paste);

    findAction = new QAction(tr("&Find"), this);
    findAction->setIcon(QIcon::fromTheme("edit-find"));
    findAction->setShortcut(QKeySequence::Find);
    connect(findAction, SIGNAL(triggered()), this, SLOT(find()));

    // Help actions
    aboutAction = new QAction(tr("&About"), this);
    aboutAction->setIcon(QIcon::fromTheme("help-about"));
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));

    aboutQtAction = new QAction(tr("About &Qt"), this);
    connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}
Example #10
0
bool MQLEdit::fileSave()
{
  if (_dest == MQLFile || (_dest == MQLUnknown && ! OpenRPT::loggedIn))
  {
    if (_fileName.isEmpty())
      return saveAs();
    else
      return save();
  }
  else if (_dest == MQLDatabase)
  {
    if (_mqlGroup.isEmpty() || _mqlName.isEmpty())
      return fileDatabaseSaveAs();
    else
      return databaseSave();
  }
  else if (_dest == MQLUnknown)
  {
    QMessageBox save;
    save.setText("How do you want to save your changes?");
    QPushButton *cancel = save.addButton(QMessageBox::Cancel);
    QPushButton *db     = save.addButton(tr("Database only"),    QMessageBox::AcceptRole);
    QPushButton *file   = save.addButton(tr("File only"),        QMessageBox::AcceptRole);
    QPushButton *both   = save.addButton(tr("Database and File"),QMessageBox::AcceptRole);
    save.setEscapeButton((QAbstractButton*)cancel);
    save.exec();

    // since _dest == MQUnknown, we can assume we don't have file/group-name
    if (save.clickedButton() == (QAbstractButton*)db)
      return fileDatabaseSaveAs();
    else if (save.clickedButton() == (QAbstractButton*)file)
      return saveAs();
    else if (save.clickedButton() == (QAbstractButton*)both)
    {
      // save to db first to get group and name
      // then reset the title and type which are changed by saveAs()
      bool returnVal = fileDatabaseSaveAs() && saveAs();
      setWindowTitle(getTitleString(MQLDatabase));
      setDestType(MQLDatabase);
      return returnVal;
    }
  }

  return false;
}
bool XmlWindow::save(){
    if(curFile.isEmpty()){
        return saveAs();
    }
    else{
        this->build_xml();
        return saveFile(curFile);
    }
}
Example #12
0
bool MyWidget::save() {
    if(fileName.isEmpty())
        return saveAs();
    else {
        FileWriter writer(fileName, model, this);
        resetModified();
        return true;
    }
}
bool ImageWindow::save()
{
    if (curFile.isEmpty()) {
        return saveAs();
    } else {
        saveFile(curFile);
        return true;
    }
}
Example #14
0
/// Save to the current filename, opening a dialog if blank
void ScriptEditor::saveToCurrentFile() {
    QString filename = fileName();
    if (filename.isEmpty()) {
        saveAs();
        return;
    } else {
        saveScript(filename);
    }
}
Example #15
0
void Editor::saveAsEncoding( int code )
{
#ifndef QT_NO_FILEDIALOG
    //storing filename (proper save) is left as an exercise...
    QString fn = QFileDialog::getSaveFileName( QString::null, QString::null, this );
    if ( !fn.isEmpty() )
	(void) saveAs( fn, code );
#endif
}
bool QFEHelpEditorWidget::save() {

    if (currentScript.isEmpty() || newScript) {
        return saveAs();
    } else {
        return saveFile(currentScript);
    }

}
Example #17
0
bool DocumentEditor::save() {
	if (!isModified() && QFile::exists(getFullPath()))
		return true;
	if (_fullPath.isEmpty()) {
		return saveAs();
	} else {
		return saveFile(_fullPath);
	}
}
Example #18
0
bool MainWindow::save() {
    if(curFile.isEmpty()) {
        qDebug() << "saveAs";
        return saveAs();
    } else {
        qDebug("saveFile");
        return saveFile(curFile);
    }
}
Example #19
0
bool Editor::save()
{
    if (isUntitled) {
        return saveAs();
    } else {
        saveFile(curFile);
        return true;
    }
}
Example #20
0
void MainWindow::createActions()
{
    newAct = new QAction(tr("&New"), this);
//    newAct = QAction(QIcon(":/images/new.png"), tr("&New"), this);
    newAct->setShortcuts(QKeySequence::New);
    newAct->setStatusTip(tr("Create a new file"));
    connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));

    openAct = new QAction(tr("&Open"), this);
//    openAct = QAction(QIcon(":/images/open.png"), tr("&Open"), this);
    openAct->setShortcuts(QKeySequence::Open);
    openAct->setStatusTip(tr("Open an existing file"));
    connect(openAct, SIGNAL(triggered()), this, SLOT(open()));

    saveAct = new QAction(tr("&Save"), this);
//    saveAct = QAction(QIcon(":/images/save.png"), tr("&Save"), this);
    saveAct->setShortcuts(QKeySequence::Save);
    saveAct->setStatusTip(tr("Create a new file"));
    connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));

    saveAsAct = new QAction(tr("&SaveAs"), this);
    saveAsAct->setShortcuts(QKeySequence::SaveAs);
    saveAsAct->setStatusTip(tr("Create a new file as"));
    connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));


    exitAct = new QAction(tr("&Exit"), this);
    exitAct->setShortcuts(QKeySequence::Quit);
    exitAct->setStatusTip(tr("Close the program"));
    connect(exitAct, SIGNAL(triggered()), this, SLOT(exitAll()));

    aboutAct = new QAction(tr("&About"), this);
    aboutAct->setStatusTip(tr("Show the About box"));
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));


    selectAllAct = new QAction(tr("&SelectAll"), this);
    selectAllAct->setShortcuts(QKeySequence::SelectAll);
    selectAllAct->setStatusTip(tr("Select and All"));
    connect(selectAllAct, SIGNAL(triggered()), this, SLOT(selectAll()));

    copyAllAct = new QAction(tr("&CopyAll"), this);
    copyAllAct->setStatusTip(tr("Select and Copy All"));
    connect(copyAllAct, SIGNAL(triggered()), this, SLOT(copyAll()));

    copyTextAct = new QAction(tr("&Copy"), this);
    copyTextAct->setShortcuts(QKeySequence::Copy);
    copyTextAct->setStatusTip(tr("Copy the text"));
    connect(copyTextAct, SIGNAL(triggered()), this, SLOT(copyText()));

    pasteTextAct = new QAction(tr("&Paste"), this);
    pasteTextAct->setShortcuts(QKeySequence::Paste);
    pasteTextAct->setStatusTip(tr("Select All"));
    connect(pasteTextAct, SIGNAL(triggered()), this, SLOT(pasteText()));

}
Example #21
0
void MainWindow::checkForFileChanges(const FileCheckMoment &moment)
{
	if (moment == FocusIn)
	{
		QDateTime lastExternalModifiedDateTime(QFileInfo(m_currentUrl.path()).lastModified());
		if (lastExternalModifiedDateTime > m_lastInternalModifiedDateTime)
			m_isModifiedExternally = true;
		else // when the fileChangedWarningMessageBox below is cancelled, the main window is focused in again with m_isModifiedExternally == true so this slot is called again, but now m_lastInternalModifiedDateTime has been updated (during focusOut) and now we don't want to show the dialog again
			return;
	}

	if (!m_isModifiedExternally)
		return;

	m_isModifiedExternally = false;
	QPointer<QMessageBox> fileChangedWarningMessageBox = new QMessageBox(this);
	fileChangedWarningMessageBox->setText(tr("The document was modified by another program.\nWhat do you want to do?"));
	fileChangedWarningMessageBox->setWindowTitle(KtikzApplication::applicationName());
	fileChangedWarningMessageBox->setIcon(QMessageBox::Warning);
	QAbstractButton *overwriteButton = fileChangedWarningMessageBox->addButton(tr("&Overwrite"), QMessageBox::AcceptRole);
	QAbstractButton *reloadButton;
	switch (moment)
	{
		case Saving:
			reloadButton = fileChangedWarningMessageBox->addButton(tr("&Save under another name"), QMessageBox::AcceptRole);
			break;
		case Closing:
			reloadButton = fileChangedWarningMessageBox->addButton(tr("&Close without saving"), QMessageBox::AcceptRole);
			break;
		case FocusIn:
		default:
			reloadButton = fileChangedWarningMessageBox->addButton(tr("&Reload file"), QMessageBox::AcceptRole);
			break;
	}
	fileChangedWarningMessageBox->addButton(QMessageBox::Cancel);
	fileChangedWarningMessageBox->exec();
	if (fileChangedWarningMessageBox->clickedButton() == overwriteButton)
		saveUrl(m_currentUrl);
	else if (fileChangedWarningMessageBox->clickedButton() == reloadButton)
		switch (moment)
		{
			case Saving:
				saveAs();
				break;
			case Closing:
				// do nothing since the file will be closed anyway
				break;
			case FocusIn:
			default:
				reload();
				break;
		}
	else // cancel (check again on "Save" or "Close")
		m_isModifiedExternally = true;
	delete fileChangedWarningMessageBox;
}
Example #22
0
bool Editor::save()
{
#ifndef QT_NO_FILEDIALOG
    //storing filename (proper save) is left as an exercise...
    QString fn = QFileDialog::getSaveFileName( QString::null, QString::null, this );
    if ( !fn.isEmpty() )
	return saveAs( fn );
    return FALSE;
#endif
}
Example #23
0
void ZGui::slot_fileSave()
{
	if ( sFileName.isEmpty() || sFilePath.isEmpty() )
	{
		slot_fileSaveAs();
	} else
	{
		saveAs( sFilePath+sFileName, true );
	}
}
Example #24
0
bool TextRoom::save()
{
	if (curFile.isEmpty() || !QFileInfo(curFile).isWritable() || shownName == "Untitled.txr")
	{
		return saveAs();
	}
	else
	{
		return saveFile(curFile);
	}
}
Example #25
0
bool KCCodeEditor::save()
{
    if(!filePath.isEmpty())
    {
        return saveAs(filePath);
    }
    else
    {
        return processSaveAsAction(tr("Save"));
    }
}
Example #26
0
void MainWindow::save()
{
	if (currentSaveFile.isEmpty()) {
		saveAs();
	} else {
		if(currentSaveFile.endsWith(".chmvp"))
			saveProject(currentSaveFile);
		else
			saveImage(currentSaveFile);
	}
}
Example #27
0
 bool CodeEditor::save()
 {
     if ( m_isUntitled )
     {
         return saveAs();
     }
     else
     {
         return saveFile( m_curFile );
     }
 }
Example #28
0
MainWindow::MainWindow(QWidget* p_parent):
  QMainWindow(p_parent),
  m_lowerRegExp("[a-z]"),
  m_upperRegExp("[A-Z]"),
  m_symbolesCount(0),
  m_fileName("Untitled"),
  m_neverSavedBefore(true),
  m_fileSaved(true) {

  // Create text edit and set central widget
  m_textEdit = new QPlainTextEdit;
  setCentralWidget(m_textEdit);

  // Connections
  connect(m_textEdit, SIGNAL(textChanged(void)), this, SLOT(cryptText(void)));
  connect(m_textEdit, SIGNAL(textChanged(void)), this, SLOT(updateNotSavedState(void)));

  // Crypt/Decrypt action
  m_cryptAction = new QAction(this);
  addAction(m_cryptAction);
  m_cryptAction->setShortcut(QKeySequence("ALT+B"));
  m_cryptAction->setCheckable(true);
  connect(m_cryptAction, SIGNAL(toggled(bool)), this, SLOT(cryptDocument(bool)));

  // Save as action
  m_saveAsAction = new QAction(this);
  addAction(m_saveAsAction);
  m_saveAsAction->setShortcut(QKeySequence(QKeySequence::SaveAs));
  connect(m_saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()));

  // Save action
  m_saveAction = new QAction(this);
  addAction(m_saveAction);
  m_saveAction->setShortcut(QKeySequence(QKeySequence::Save));
  connect(m_saveAction, SIGNAL(triggered()), this, SLOT(save()));

  // Open action
  m_openAction = new QAction(this);
  addAction(m_openAction);
  m_openAction->setShortcut(QKeySequence(QKeySequence::Open));
  connect(m_openAction, SIGNAL(triggered()), this, SLOT(open()));

  // New action
  m_newAction = new QAction(this);
  addAction(m_newAction);
  m_newAction->setShortcut(QKeySequence(QKeySequence::New));
  connect(m_newAction, SIGNAL(triggered()), this, SLOT(newDoc()));

  // Set window title
  m_textEdit->setDocumentTitle(m_fileName);

  // Full screen
  setWindowState(Qt::WindowMaximized);
}
Example #29
0
void Theme::save_theme(Fl_Browser *usr_theme){
	debug_out("void save_theme(Fl_Browser *usr_theme)");
	std::string save_name = choose_directory(gettext("Save File"));
	if(save_name.compare("")==0){return;}
	int result = saveAs(save_name);
	if(result!=0){
		errorOUT("Problem saving: "+save_name);
		return;
	}
	populateUserThemes(usr_theme);
}
Example #30
0
// ****************************************************************************
//  Method:  XMLEdit::save
//
//  Purpose:
//    Menu callback: Save the file with its existing name, or prompt if 
//    it was still unnamed.
//
//  Programmer:  Jeremy Meredith
//  Creation:    October 17, 2002
//
// ****************************************************************************
void
XMLEdit::save()
{
    if (xmldoc->filename == tr("untitled.xml"))
    {
        saveAs();
        return;
    }

    SaveFile(xmldoc->filename);
}