bool MainWindow::saveDocument(Document* doc) { bool success = false; if (doc->ocafDoc()->IsSaved()) { if(doc->ocafDoc()->IsModified()) { success = doc->save(); if (success) statusBar()->showMessage(doc->name() + " saved", 2000); } } else { success = saveDocumentAs(doc); } return success; }
MinervaWindow::MinervaWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MinervaWindow){ window=this; psettings=NULL; ui->setupUi(this); setCentralWidget(ui->documentTabs); connect(ui->actionNew,SIGNAL(triggered()),this,SLOT(newDocument())); connect(ui->action_Open,SIGNAL(triggered()),this,SLOT(openDocument())); connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close())); connect(ui->action_Save,SIGNAL(triggered()),this,SLOT(saveDocument())); connect(ui->actionSave_As,SIGNAL(triggered()),this,SLOT(saveDocumentAs())); connect(ui->actionAbout_Minerva,SIGNAL(triggered()),this,SLOT(about())); connect(ui->documentTabs,SIGNAL(tabCloseRequested(int)),this,SLOT(closeDocument(int))); connect(ui->actionPlugins,SIGNAL(triggered()),this,SLOT(openPluginsConfiguration())); formats = new QFormatScheme(QString("%1/share/minerva/qxs/formats.qxf").arg(ROOTDIR), this); QDocument::setDefaultFormatScheme(formats); QLineMarksInfoCenter::instance()->loadMarkTypes(QString("%1/share/minerva/qxs/marks.qxm").arg(ROOTDIR)); languages = new QLanguageFactory(formats, this); languages->addDefinitionPath(QString("%1/share/minerva/qxs").arg(ROOTDIR)); editors=new QList<MinervaDocument*>(); }
void MainWindow::saveAs() { saveDocumentAs(currentDoc()); }