Exemplo n.º 1
0
void Note::open()
{
    if(!FLoc.isEmpty())
        goto skip;
    FLoc = QFileDialog::getOpenFileName(this, "Open");
    skip:
    QFile ofile(FLoc);
    if(!ofile.open(QFile::ReadOnly | QFile::Text))
    {
        QMessageBox::StandardButton ret;
        QMessageBox::warning(this, tr("Application"),
                                       tr("The specified path doesn't exist or you don't have Permissions to view file.\n"
                                          "Note will open a New file."),
                                       QMessageBox::Ok);
        FLoc="";
    }

    else
    {
        fileName=FLoc;
        QTextStream in(&ofile);
        QString text = in.readAll();
        ofile.close();

        textEdit->setPlainText(text);
        textEdit->setWordWrapMode(QTextOption::NoWrap);
        setCurrentFileName(fileName);
        FLoc="";
    }
}
Exemplo n.º 2
0
void CreateBlogMsg::fileNew()
{
    if (maybeSave()) {
        ui.msgEdit->clear();
        setCurrentFileName(QString());
    }
}
Exemplo n.º 3
0
void BrailleMusicEditor::fileNew() {
  if (maybeSave()) {
    textEdit->clear();
    setCurrentFileName(QString());
    showEmptySVG();
  }
}
Exemplo n.º 4
0
void TextEdit::fileNew()
{
    if (maybeSave()) {
        textEdit->clear();
        setCurrentFileName(QString());
    }
}
Exemplo n.º 5
0
bool TextEdit::load(const QString &f)
{
  cout<<"textedit.load:"<<f;
  if (!QFile::exists(f)){
    cout<<"textedit.load:not exists"<<f;
    return false;
  }
  QFile file(f);
  if (!file.open(QFile::ReadOnly))
    return false;

  QByteArray data = file.readAll();
  QTextCodec *codec = Qt::codecForHtml(data);
  QString str = codec->toUnicode(data);
  if (Qt::mightBeRichText(str)) {
    cout<<"textedit.load:";
    textEdit->setHtml(str);
  } else {
    str = QString::fromLocal8Bit(data);
    textEdit->setPlainText(str);
  }
  setCurrentFileName(f);
  docs.clear();
  return true;
}
Exemplo n.º 6
0
// Slots
void MainWindow::on_actionNew_triggered()
{
    if(!confirmToGo())
        return;

    spreadsheet->clear();
    setCurrentFileName("");
}
Exemplo n.º 7
0
void Note::newFile()
{
    if (Note::savecheck())
    {
        textEdit->clear();
        setCurrentFileName(QString());
    }
}
Exemplo n.º 8
0
bool erMacroDropAnalysis::doIt(std::string fich)
{      bool loaded;
       char* file_name         = const_cast<char*>(fich.c_str());
       setCurrentFileName(file_name);
       erImage ea;
       boost::tie( ea, loaded) = erLoadImage( file_name);
       if( !loaded) return false;
       doItImage(ea);
};
Exemplo n.º 9
0
bool CryptoPage::fileSaveAs()
{
    QString fn;
    if (misc::getSaveFileName(this, RshareSettings::LASTDIR_CERT, tr("Save as..."), tr("RetroShare Certificate (*.rsc );;All Files (*)"), fn)) {
        setCurrentFileName(fn);
        return fileSave();
    }
    return false;
}
Exemplo n.º 10
0
bool TextEdit::fileSaveAs()
{
    QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
                                              QString(), tr("HTML-Files (*.htm *.html);;All Files (*)"));
    if (fn.isEmpty())
        return false;
    setCurrentFileName(fn);
    return fileSave();
}
Exemplo n.º 11
0
bool Note::saveAs()
{
    fn = QFileDialog::getSaveFileName(this, tr("Save as"), QString(),
                                                  tr("Text Document (*.txt);;All Files (*)"));
        fileName = fn;
        if(fileName.isEmpty())
            return false;
        setCurrentFileName(fn);
        return Note::save();
}
Exemplo n.º 12
0
bool FriendsDialog::fileSaveAs()
{
    QString fn;
    if (misc::getSaveFileName(this, RshareSettings::LASTDIR_HISTORY, tr("Save as..."), tr("Text File (*.txt );;All Files (*)"), fn)) {
        setCurrentFileName(fn);
        return fileSave();
    }

    return false;
}
Exemplo n.º 13
0
bool ChatWidget::fileSaveAs()
{
	QString fn;
	if (misc::getSaveFileName(window(), RshareSettings::LASTDIR_HISTORY, tr("Save as..."), tr("Text File (*.txt );;All Files (*)"), fn)) {
		setCurrentFileName(fn);
		return fileSave();
	}

	return false;
}
bool erMultiMetalTransfertAnalysis::doIt( std::string fich)
{
  erImage ea;
  bool loaded;
  char* file_name         = const_cast< char*>( fich.c_str());
  setCurrentFileName(file_name);
  boost::tie(ea, loaded) = erLoadImage( file_name);
  if( !loaded) return false;
  return doItImage(ea);
};
Exemplo n.º 15
0
bool TextEdit::fileSaveAs()
{
    QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
                                              QString(), tr("ODF files (*.odt);;HTML-Files (*.htm *.html);;All Files (*)"));
    if (fn.isEmpty())
        return false;
    if (! (fn.endsWith(".odt", Qt::CaseInsensitive) || fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) )
        fn += ".odt"; // default
    setCurrentFileName(fn);
    return fileSave();
}
Exemplo n.º 16
0
bool CreateBlogMsg::fileSaveAs()
{
    QString fn;
    if (misc::getSaveFileName(this, RshareSettings::LASTDIR_BLOGS, tr("Save as..."), tr("ODF files (*.odt);;HTML-Files (*.htm *.html);;All Files (*)"), fn)) {
        if (! (fn.endsWith(".odt", Qt::CaseInsensitive) || fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) )
            fn += ".odt"; // default
        setCurrentFileName(fn);
        return fileSave();
    }

    return false;
}
Exemplo n.º 17
0
bool erWeldPoolAnalysis::doIt(std::string fich)
{ 
  bool loaded;
  char* file_name         = const_cast< char*>( fich.c_str());
  std::cout << "Nom du fichier:" << file_name << std::endl;
  setCurrentFileName(file_name);
  erImage ea;
  
  boost::tie(ea, loaded) = erLoadImage( file_name);
  if( !loaded)return false;
  doItImage(ea);
};
Exemplo n.º 18
0
bool MainWindow::loadFile(const QString &fileName)
{
    if(!spreadsheet->readFile(fileName)){
        ui->statusBar->showMessage(tr("Loading canceled"), 2000);
        return false;
    }

    setCurrentFileName(fileName);
    ui->statusBar->showMessage(tr("File loaded"));
    return true;

}
Exemplo n.º 19
0
bool MainWindow::saveFile(const QString &fileName)
{

    if(!spreadsheet->writeFile(fileName)){
        ui->statusBar->showMessage(tr("Saving canceled"), 2000);
        return false;
    }
    setCurrentFileName(fileName);
    ui->statusBar->showMessage(QString("%1 ").arg(getCurrentFileName()) += tr("has been saved"), 2000);

    return true;

}
Exemplo n.º 20
0
bool BrailleMusicEditor::load(const QString &f) {
  if (!QFile::exists(f)) return false;
  QFile file(f);
  if (!file.open(QFile::ReadOnly)) return false;

  QByteArray data = file.readAll();
  QTextCodec *codec = QTextCodec::codecForName("UTF-8");
  QString str = codec->toUnicode(data);
  textEdit->setPlainText(str);

  setCurrentFileName(f);
  return true;
}
Exemplo n.º 21
0
bool BrailleMusicEditor::fileSaveAs() {
  QString fn = QFileDialog::getSaveFileName(
    this, tr("Save as..."), QString(),
    tr("Braille music files (*.bmc);;LilyPond-Files "
       "(*.ly);;MusicXML Files (*.xml)"));
  if (fn.isEmpty()) return false;
  if (!(fn.endsWith(".bmc", Qt::CaseInsensitive) ||
        fn.endsWith(".ly", Qt::CaseInsensitive) ||
        fn.endsWith(".xml", Qt::CaseInsensitive))) {
    fn += ".bmc"; // default
  }
  setCurrentFileName(fn);
  return fileSave();
}
Exemplo n.º 22
0
// Save as HTML
bool TextEdit::fileSaveAsHtml()
{
	QString fn = QFileDialog::getSaveFileName(this, tr("Save as HTML"),
                                             "/boot/home/Desktop/Untitled",    
                                             /* tr("HTML document (*.html)"), 0, QFileDialog::DontUseNativeDialog ); */ // QT file dialog
                                             tr("HTML document (*.html)")); // Native file dialog

    if (fn.isEmpty())
        return false;
    /* if (! fn.endsWith(".txt", Qt::CaseInsensitive) || (fn.endsWith(".odt", Qt::CaseInsensitive) || fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) ) */
        fn += ".html"; // set the extension
    setCurrentFileName(fn);
    return fileSave();
}
Exemplo n.º 23
0
// ---------------------------------------------------------------------------
bool 
TextEdit::fileSaveAs()
{
    QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
                                              QString(),  tr("TXT files (*.txt);;All Files (*)"));
    if (fn.isEmpty())
        return false;

    if (! fn.endsWith(".txt", Qt::CaseInsensitive) )
        fn += ".txt"; // default

    setCurrentFileName(fn);
    return fileSave();
}
Exemplo n.º 24
0
bool HtmlEditor::fileSaveAs()
{
    QString path = Settings.savePath();
    path.append("/.html");
    QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
                 path, tr("HTML-Files (*.htm *.html);;All Files (*)"));
    if (fn.isEmpty())
        return false;
    if (!(fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)))
        fn += ".htm"; // default
    setCurrentFileName(fn);
    Settings.setSavePath(QFileInfo(fn).path());
    return fileSave();
}
Exemplo n.º 25
0
// ---------------------------------------------------------------------------
bool TextEdit::load(const QString &f)
{
    if (!QFile::exists(f))
        return false;

    QFile file(f);
    if (!file.open(QFile::ReadOnly))
        return false;

    QByteArray data = file.readAll();
    textEdit->setPlainText(data);

    setCurrentFileName(f);
    return true;
}
Exemplo n.º 26
0
bool HtmlEditor::load(const QString &f)
{
    if (!QFile::exists(f))
        return false;
    QFile file(f);
    if (!file.open(QFile::ReadOnly))
        return false;

    QByteArray data = file.readAll();
    ui->webView->setContent(data, "text/html");
    ui->webView->page()->setContentEditable(true);
    ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    connect(ui->webView, SIGNAL(linkClicked(QUrl)), SLOT(openLink(QUrl)));

    setCurrentFileName(f);
    return true;
}
Exemplo n.º 27
0
bool MainWindow::saveFile(QString _fullPath)
{
	QFileInfo fi(_fullPath);
	QString dir = fi.path();
	if (dir.at(dir.length()-1) !=  QDir::separator())
		dir.append(QDir::separator());
	lastDir = dir;

	ui.workArea->setUpdatesEnabled(false);
	textureModel->SaveAtlas(_fullPath);
	ui.workArea->setUpdatesEnabled(true);
	ui.workArea->update();

	setCurrentFileName(_fullPath);
	statusBar()->showMessage(tr("File saved"), 2000);
	return true;
}
Exemplo n.º 28
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    spreadsheet = new Spreadsheet;
    setCentralWidget(spreadsheet);
    findDialog = 0;
    setCurrentFileName("");


    initStatusBar();
    initToggleAction();
    initrecentFilesAction();
    setActionShortcuts();
    createContextMenu();

    readSettings();
}
Exemplo n.º 29
0
bool CreateBlogMsg::load(const QString &f)
{
    if (!QFile::exists(f))
        return false;
    QFile file(f);
    if (!file.open(QFile::ReadOnly))
        return false;

    QByteArray data = file.readAll();
    QTextCodec *codec = Qt::codecForHtml(data);
    QString str = codec->toUnicode(data);
    if (Qt::mightBeRichText(str)) {
        ui.msgEdit->setHtml(str);
    } else {
        str = QString::fromLocal8Bit(data);
        ui.msgEdit->setPlainText(str);
    }

    setCurrentFileName(f);
    return true;
}
Exemplo n.º 30
0
void MainWindow::loadFile()
{
	QString path = QFileDialog::getOpenFileName(this, tr("Load Atlas..."),
					lastDir, tr("Atlas files (*.png);;All Files (*)"));

	if ((!path.isEmpty()) && (QFile::exists(path)))
	{
		QFileInfo fi(path);
		QString dir = fi.path();
		if (dir.at(dir.length()-1) !=  QDir::separator())
			dir.append(QDir::separator());
		lastDir = dir;

		ui.workArea->setUpdatesEnabled(false);
		ui.workArea->textureDeleted();
		textureModel->LoadAtlas(path);
		ui.workArea->setUpdatesEnabled(true);
		ui.workArea->update();
		setCurrentFileName(path);
	}
}