Merge branch 'feature/saveLoadItemsInFromFile' into develop

This commit is contained in:
2025-12-23 14:02:12 +01:00
3 changed files with 13 additions and 4 deletions

View File

@ -20,6 +20,7 @@ void EditItemDialog::createContent() {
m_contentContainer = m_detailMapper;
m_outerLayout->insertWidget(0, m_contentContainer);
}
void EditItemDialog::accept() {
m_detailMapper->submit();

View File

@ -22,7 +22,8 @@ MainWindow::MainWindow(QWidget* parent)
ui->setupUi(this);
m_core = std::make_unique<GenericCore>();
setWindowTitle(windowTitle() + " [*]");
setWindowTitle(QCoreApplication::applicationName() + " [*]");
/// application icon
const QString iconString = "://feature.png";
@ -76,7 +77,7 @@ void MainWindow::closeEvent(QCloseEvent* event) {
switch (ret) {
case QMessageBox::Save:
// TODO m_core->saveItems();
emit saveItems();
event->accept();
break;
case QMessageBox::Discard:
@ -232,6 +233,11 @@ void MainWindow::onShowUndoViewToggled(bool checked) {
}
}
void MainWindow::saveItems() {
showStatusMessage(tr("Invoked 'File|Save'"));
m_core->saveItems();
}
void MainWindow::createActions() {
// TODO add generic menu actions (file/new, edit/cut, ...)
createFileActions();
@ -257,8 +263,7 @@ void MainWindow::createFileActions() {
m_saveAct = make_unique<QAction>(tr("&Save"), this);
m_saveAct->setShortcuts(QKeySequence::Save);
m_saveAct->setStatusTip(tr("Save the document to disk"));
// connect(m_saveAct, &QAction::triggered, this, &MainWindow::save);
m_saveAct->setEnabled(false);
connect(m_saveAct.get(), &QAction::triggered, this, &MainWindow::saveItems);
ui->menu_File->addAction(m_saveAct.get());
ui->menu_File->addSeparator();

View File

@ -54,6 +54,9 @@ class MainWindow : public QMainWindow {
void onCleanStateChanged(bool clean);
void onShowUndoViewToggled(bool checked);
/// 'File' slots
void saveItems();
private:
Ui::MainWindow* ui;