Changed: #1306 Implemented basic form saving.

This commit is contained in:
sfb 2012-05-03 08:02:14 -05:00
parent 5c8ba72685
commit 7abfe97f3e
2 changed files with 27 additions and 23 deletions

View file

@ -63,7 +63,7 @@ namespace GeorgesQt
m_undoStack = new QUndoStack(this); m_undoStack = new QUndoStack(this);
Core::MenuManager *menuManager = Core::ICore::instance()->menuManager(); Core::MenuManager *menuManager = Core::ICore::instance()->menuManager();
m_openAction = menuManager->action(Core::Constants::OPEN); m_openAction = menuManager->action(Core::Constants::OPEN);
m_newAction = new QAction(tr("&New..."), this); m_newAction = new QAction(tr("&New..."), this);
@ -124,6 +124,8 @@ namespace GeorgesQt
void GeorgesEditorForm::save() void GeorgesEditorForm::save()
{ {
m_lastActiveDock->write();
m_saveAction->setEnabled(false);
} }

View file

@ -101,10 +101,12 @@ namespace GeorgesQt
void CGeorgesTreeViewDialog::headerClicked(int section) void CGeorgesTreeViewDialog::headerClicked(int section)
{ {
if (section == 0) if (section == 0)
{
if (*(m_header->expanded())) if (*(m_header->expanded()))
m_ui.treeView->expandAll(); m_ui.treeView->expandAll();
else else
m_ui.treeView->collapseAll(); m_ui.treeView->collapseAll();
}
} }
void CGeorgesTreeViewDialog::setForm(const CForm *form) void CGeorgesTreeViewDialog::setForm(const CForm *form)
@ -263,12 +265,12 @@ namespace GeorgesQt
void CGeorgesTreeViewDialog::write( ) void CGeorgesTreeViewDialog::write( )
{ {
//COFile file; NLMISC::COFile file;
//std::string s = CPath::lookup(loadedForm.toStdString(), false); std::string s = NLMISC::CPath::lookup(loadedForm.toStdString(), false);
//if (file.open (s)) if(file.open (s))
//{ {
// try try
// { {
// if (loadedForm.contains(".typ")) // if (loadedForm.contains(".typ"))
// { // {
// //nlassert (Type != NULL); // //nlassert (Type != NULL);
@ -281,7 +283,7 @@ namespace GeorgesQt
// // flushValueChange (); // // flushValueChange ();
// //} // //}
// //Type->write (xmlStream.getDocument (), theApp.Georges4CVS); // //Type->write (xmlStream.getDocument (), theApp.Georges4CVS);
// //modify (NULL, NULL, false); // //modify (NULL, NULL, false);
// //flushValueChange (); // //flushValueChange ();
// //UpdateAllViews (NULL); // //UpdateAllViews (NULL);
// //return TRUE; // //return TRUE;
@ -303,17 +305,17 @@ namespace GeorgesQt
// } // }
// else // else
// { // {
// nlassert (_form != NULL); nlassert (m_form != NULL);
// // Write the file // Write the file
// /*if (IsModified ()) // /*if (IsModified ())
// { // {
// ((CForm*)(UForm*)Form)->Header.MinorVersion++; // ((CForm*)(UForm*)Form)->Header.MinorVersion++;
// }*/ // }*/
// //((CForm*)(UForm*)Form)->write (xmlStream.getDocument (), lpszPathName, theApp.Georges4CVS); // //((CForm*)(UForm*)Form)->write (xmlStream.getDocument (), lpszPathName, theApp.Georges4CVS);
// _form->write(file, false); m_form->write(file, false);
// setWindowTitle(windowTitle().remove("*")); setWindowTitle(windowTitle().remove("*"));
// _modified = false; m_modified = false;
// //if (strcmp (xmlStream.getErrorString (), "") != 0) // //if (strcmp (xmlStream.getErrorString (), "") != 0)
// //{ // //{
// // char message[512]; // // char message[512];
@ -327,16 +329,16 @@ namespace GeorgesQt
// // Get the left view // // Get the left view
// //CView* pView = getLeftView (); // //CView* pView = getLeftView ();
// } // }
// } }
// catch (Exception &e) catch (Exception &e)
// { {
// nlerror("Error while loading file: %s", e.what()); nlerror("Error while loading file: %s", e.what());
// } }
//} }
//else else
//{ //if (!file.open()) {
// nlerror("Can't open the file %s for writing.", s.c_str()); nlerror("Can't open the file %s for writing.", s.c_str());
//} }
} }
void CGeorgesTreeViewDialog::doubleClicked ( const QModelIndex & index ) void CGeorgesTreeViewDialog::doubleClicked ( const QModelIndex & index )