diff --git a/src/layui/layui/MarkerBrowserDialog.ui b/src/layui/layui/MarkerBrowserDialog.ui
index 65a398b74..298ac92a3 100644
--- a/src/layui/layui/MarkerBrowserDialog.ui
+++ b/src/layui/layui/MarkerBrowserDialog.ui
@@ -368,6 +368,14 @@ to load a marker database
QAction::NoRole
+
+
+ Save As Waiver DB
+
+
+ QAction::NoRole
+
+
diff --git a/src/layui/layui/rdbMarkerBrowserDialog.cc b/src/layui/layui/rdbMarkerBrowserDialog.cc
index 6f7fb1f14..e388ef7da 100644
--- a/src/layui/layui/rdbMarkerBrowserDialog.cc
+++ b/src/layui/layui/rdbMarkerBrowserDialog.cc
@@ -88,6 +88,7 @@ MarkerBrowserDialog::MarkerBrowserDialog (lay::Dispatcher *root, lay::LayoutView
connect (mp_ui->open_action, SIGNAL (triggered ()), this, SLOT (open_clicked ()));
connect (mp_ui->save_action, SIGNAL (triggered ()), this, SLOT (save_clicked ()));
connect (mp_ui->saveas_action, SIGNAL (triggered ()), this, SLOT (saveas_clicked ()));
+ connect (mp_ui->saveas_waiver_db_action, SIGNAL (triggered ()), this, SLOT (saveas_waiver_db_clicked ()));
connect (mp_ui->export_action, SIGNAL (triggered ()), this, SLOT (export_clicked ()));
connect (mp_ui->reload_action, SIGNAL (triggered ()), this, SLOT (reload_clicked ()));
connect (mp_ui->info_action, SIGNAL (triggered ()), this, SLOT (info_clicked ()));
@@ -97,6 +98,7 @@ MarkerBrowserDialog::MarkerBrowserDialog (lay::Dispatcher *root, lay::LayoutView
mp_ui->file_menu->addAction (mp_ui->open_action);
mp_ui->file_menu->addAction (mp_ui->save_action);
mp_ui->file_menu->addAction (mp_ui->saveas_action);
+ mp_ui->file_menu->addAction (mp_ui->saveas_waiver_db_action);
QAction *sep0 = new QAction (mp_ui->file_menu);
sep0->setSeparator (true);
mp_ui->file_menu->addAction (mp_ui->export_action);
@@ -393,6 +395,28 @@ BEGIN_PROTECTED
END_PROTECTED
}
+void
+MarkerBrowserDialog::saveas_waiver_db_clicked ()
+{
+BEGIN_PROTECTED
+
+ rdb::Database *rdb = 0;
+ if (m_rdb_index < int (view ()->num_rdbs ()) && m_rdb_index >= 0) {
+ rdb = view ()->get_rdb (m_rdb_index);
+ }
+ if (! rdb) {
+ return;
+ }
+
+ if (rdb->filename ().empty ()) {
+ throw tl::Exception (tl::to_string (tr ("The current report database is not saved.\nSave it to some file with 'Save As', before saving it as waiver DB.")));
+ }
+
+ rdb->write (rdb->filename () + ".w");
+
+END_PROTECTED
+}
+
void
MarkerBrowserDialog::saveas_clicked ()
{
@@ -760,6 +784,7 @@ MarkerBrowserDialog::update_content ()
mp_ui->save_action->setEnabled (rdb != 0);
mp_ui->saveas_action->setEnabled (rdb != 0);
+ mp_ui->saveas_waiver_db_action->setEnabled (rdb != 0);
mp_ui->export_action->setEnabled (rdb != 0);
mp_ui->unload_action->setEnabled (rdb != 0);
mp_ui->unload_all_action->setEnabled (rdb != 0);
diff --git a/src/layui/layui/rdbMarkerBrowserDialog.h b/src/layui/layui/rdbMarkerBrowserDialog.h
index 3d651b3fb..a7844414e 100644
--- a/src/layui/layui/rdbMarkerBrowserDialog.h
+++ b/src/layui/layui/rdbMarkerBrowserDialog.h
@@ -77,6 +77,7 @@ public slots:
void info_clicked ();
void save_clicked ();
void saveas_clicked ();
+ void saveas_waiver_db_clicked ();
void export_clicked ();
void reload_clicked ();
void open_clicked ();
diff --git a/src/rdb/rdb/rdb.h b/src/rdb/rdb/rdb.h
index d8f6c3d18..d368b5332 100644
--- a/src/rdb/rdb/rdb.h
+++ b/src/rdb/rdb/rdb.h
@@ -2444,6 +2444,13 @@ public:
*/
void save (const std::string &filename);
+ /**
+ * @brief Write the database to a file
+ *
+ * This function is like "save", but does not update the file name attribute.
+ */
+ void write (const std::string &filename);
+
/**
* @brief Load the database from a file
*
diff --git a/src/rdb/rdb/rdbFile.cc b/src/rdb/rdb/rdbFile.cc
index d7575e839..e6159b6a4 100644
--- a/src/rdb/rdb/rdbFile.cc
+++ b/src/rdb/rdb/rdbFile.cc
@@ -118,17 +118,25 @@ make_rdb_structure (rdb::Database *rdb)
}
// -------------------------------------------------------------
-// Implementation of rdb::Database::save
+// Implementation of rdb::Database::save and write
// TODO: move this somewhere else - with generalized functionality
void
rdb::Database::save (const std::string &fn)
{
- tl::OutputStream os (fn, tl::OutputStream::OM_Auto);
- make_rdb_structure (this).write (os, *this);
+ write (fn);
set_filename (fn);
+}
- tl::log << "Saved RDB to " << fn;
+void
+rdb::Database::write (const std::string &fn)
+{
+ tl::OutputStream os (fn, tl::OutputStream::OM_Auto);
+ make_rdb_structure (this).write (os, *this);
+
+ if (tl::verbosity () >= 10) {
+ tl::log << "Saved RDB to " << fn;
+ }
}
// -------------------------------------------------------------