diff -r 1f41709aa387 -r 31c3d5f142c1 mapeditor.cpp --- a/mapeditor.cpp Mon Apr 24 11:31:16 2006 +0000 +++ b/mapeditor.cpp Mon May 08 13:26:08 2006 +0000 @@ -36,6 +36,7 @@ #include "misc.h" #include "settings.h" #include "texteditor.h" +#include "warningdialog.h" #include "xml.h" @@ -334,13 +335,19 @@ QString MapEditor::getName (LinkableMapObj *lmo) { - if (!lmo) return QString("NULL has no name!"); + QString s; + if (!lmo) return QString("Error: NULL has no name!"); if ((typeid(*lmo) == typeid(BranchObj) || typeid(*lmo) == typeid(MapCenterObj))) - return QString("branch (%1)").arg(((BranchObj*)lmo)->getHeading()); + { + + s=(((BranchObj*)lmo)->getHeading()); + if (s=="") s="unnamed"; + return QString("branch (%1)").arg(s); + } if ((typeid(*lmo) == typeid(FloatImageObj) )) - return QString ("floatimage [%1]").arg(((FloatImageObj*)lmo)->getOriginalFilename()); + return QString ("floatimage [%1]").arg(((FloatImageObj*)lmo)->getOriginalFilename()); return QString("Unknown type has no name!"); } @@ -1426,6 +1433,7 @@ if (typeid(*selection) == typeid(BranchObj) ) { bo=(BranchObj*)selection; + if (!bo->canMoveBranchUp()) return; par=(BranchObj*)(bo->getParObj()); selection->unselect(); selection=par->moveBranchUp (bo); @@ -1446,6 +1454,7 @@ if (typeid(*selection) == typeid(BranchObj) ) { bo=(BranchObj*)selection; + if (!bo->canMoveBranchDown()) return; par=(BranchObj*)(bo->getParObj()); selection->unselect(); selection=par->moveBranchDown(bo); @@ -2183,7 +2192,7 @@ else s="Set"; saveState(selection, QString("%1 standard flag \"%2\" of %3").arg(s).arg(f).arg(getName(bo)));// TODO undoCommand - bo->toggleStandardFlag (f,actionSettingsUseFlagGroups); + bo->toggleStandardFlag (f,actionSettingsUseFlagGroups->isOn()); adjustCanvasSize(); } } @@ -2575,6 +2584,17 @@ actionEditOpenVymLink->setEnabled (true); actionEditDeleteVymLink->setEnabled (true); } + + if (bo->canMoveBranchUp()) + actionEditMoveUp->setEnabled (true); + else + actionEditMoveUp->setEnabled (false); + if (bo->canMoveBranchDown()) + actionEditMoveDown->setEnabled (true); + else + actionEditMoveDown->setEnabled (false); + + actionEditToggleHideExport->setEnabled (true); actionEditToggleHideExport->setOn (bo->hideInExport() ); @@ -2625,6 +2645,8 @@ actionEditDelete->setEnabled (true); actionFormatHideLinkUnselected->setOn ( selection->getHideLinkUnselected()); + actionEditMoveUp->setEnabled (false); + actionEditMoveDown->setEnabled (false); } } else @@ -2637,12 +2659,15 @@ for (a=actionListBranches.first();a;a=actionListBranches.next()) a->setEnabled(false); - actionEditToggleScroll->setEnabled (true); + actionEditToggleScroll->setEnabled (false); actionEditOpenURL->setEnabled (false); actionEditOpenVymLink->setEnabled (false); actionEditDeleteVymLink->setEnabled (false); actionEditHeading2URL->setEnabled (false); actionEditDelete->setEnabled (false); + actionEditMoveUp->setEnabled (false); + actionEditMoveDown->setEnabled (false); + actionEditToggleHideExport->setEnabled (false); } } @@ -3047,6 +3072,16 @@ void MapEditor::testFunction() { cout << "MapEditor::testFunction() called\n"; + + WarningDialog dia; + dia.setCancelButton (true); + dia.setText("This is a longer \nWarning"); + dia.setCaption("Warning: Flux problem"); + dia.setShowAgainName("/vym/warnings/mapeditor"); + if (dia.exec()==QDialog::Accepted) + cout << "accepted!\n"; + else + cout << "canceled!\n"; return; QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";